What Even is Cloud Native? (ScotlandPHP 2017)

69172dc4e4cc3e4cdd234c40adf395fa?s=47 David McKay
November 07, 2017

What Even is Cloud Native? (ScotlandPHP 2017)

The Cloud Native Computing Foundation, the organisation currently governing Kubernetes, Prometheus, OpenTracing, and more; describe the three goals of "Cloud Native" applications as:

Containerized
Each part (applications, processes, etc) is packaged in its own container. This facilitates reproducibility, transparency, and resource isolation.

Dynamically orchestrated
Containers are actively scheduled and managed to optimize resource utilization.

Microservices oriented
Applications are segmented into microservices. This significantly increases the overall agility and maintainability of applications.
In this talk, I will guide you towards taking your application cloud native, utilising the software available to us today, from the CNCF, and others, covering containers, tracing, logging and service discovery ... as well as the dreaded: "What actually is a micro-service?"

69172dc4e4cc3e4cdd234c40adf395fa?s=128

David McKay

November 07, 2017
Tweet

Transcript

  1. 2.

    @rawkode #scotphp17 David McKay Software Consultant ➔ User Group Organiser

    ◆ Cloud Native Glasgow ◆ Docker Glasgow ◆ DevOps Glasgow ◆ Pair Programming Glasgow ◆ MongoDB Glasgow ➔ Developer ◆ Elixir ◆ Go ◆ Pony ◆ Crystal ◆ PHP
  2. 8.

    @rawkode #scotphp17 Cloud Native Computing Foundation (CNCF) 1. Containerized Each

    part (applications, processes, etc) is packaged in its own container. This facilitates reproducibility, transparency, and resource isolation 2. Dynamically Orchestrated Containers are actively scheduled and managed to optimize resource utilization 3. Microservices Oriented Applications are segmented into microservices. This significantly increases the overall agility and maintainability of applications.
  3. 9.

    @rawkode #scotphp17 Containerized “Each part (applications, processes, etc) is packaged

    in its own container. This facilitates reproducibility, transparency, and resource isolation”
  4. 13.

    @rawkode #scotphp17 Containerized: Transparency FROM alpine:3.5 RUN apk update &&

    apk add php ENTRYPOINT [ “php” ] CMD [“-v”]
  5. 16.

    @rawkode #scotphp17 Microservices Oriented Applications are segmented into microservices. This

    significantly increases the overall agility and maintainability of applications.
  6. 19.

    @rawkode #scotphp17 Cloud Native Computing Foundation (CNCF) ★ Kubernetes ★

    Prometheus ★ OpenTracing ★ Fluentd ★ Linkerd ★ gRPC ★ CoreDNS ★ containerd ★ rkt ★ CNI ★ Envoy ★ Jaeger
  7. 26.

    @rawkode #scotphp17 Fluent Bit Logging Written in C > 13k

    events per second ~ 450KIB RAM Footprint
  8. 27.

    @rawkode #scotphp17 Fluentd/Bit Logging Plugins: ➔ AWS ➔ GCP ➔

    MySQL / PostgreSQL ➔ Elasticsearch ➔ Docker ➔ Kubernetes ➔ Twitter ➔ Kafka
  9. 33.

    @rawkode #scotphp17 Prometheus Monitoring Export Everything! ➔ Elasticsearch ➔ Consul

    ➔ MongoDB ➔ RabbitMQ ➔ Kafka ➔ Apache ➔ Nginx ➔ Fluentd ➔ …
  10. 35.

    @rawkode #scotphp17 Prometheus Monitoring Manual Instrumentation $counter = newCounter([ 'namespace'

    => 'myApp', 'subsystem' => 'Prod', 'name' => 'httpRequests', ]); $counter->increment( ['url' => '/login', 'status_code' => 200 ], 1);
  11. 36.

    @rawkode #scotphp17 Prometheus Monitoring Manual Instrumentation $counter = newCounter([ 'namespace'

    => 'myApp', 'subsystem' => 'Prod', 'name' => 'httpRequests', ]); $counter->increment( ['url' => '/login', 'status_code' => 200 ], 1);
  12. 37.

    @rawkode #scotphp17 Prometheus Monitoring Manual Instrumentation $counter = newCounter([ 'namespace'

    => 'myApp', 'subsystem' => 'Prod', 'name' => 'httpRequests', ]); $counter->increment( ['url' => '/login', 'status_code' => 200 ], 1);
  13. 40.

    @rawkode #scotphp17 OpenTracing Tracing Libraries available in 9 languages: Go,

    JavaScript, Java, Python, Ruby, PHP, Objective-C, C++, C#
  14. 44.

    @rawkode #scotphp17 1. Automation DevOps isn’t just a buzzword ➔

    Continuous Integration ➔ Automated Tests ➔ Automated Deployment
  15. 46.

    @rawkode #scotphp17 2. 12-Factor Build Once. Deploy Anywhere. ➔ Version

    Control ➔ Explicit Dependencies ➔ Environment Based Config ◆ Runtime Injection Preferred ➔ Build. Release. Run. ➔ Disposability
  16. 50.

    @rawkode #scotphp17 4. Logging Understanding what is going wrong Centralised

    Logging ➔ ssh prod ☹ ➔ Log to a central place ➔ Cross-sections ➔ Exception Tracking
  17. 52.
  18. 53.
  19. 56.

    @rawkode #scotphp17 6. Micro-services Just don’t ask me to quantify

    “micro” ➔ Don’t refactor, replace ➔ Simplified testing ➔ Fast CI/Deploy ➔ Simple on-boarding
  20. 58.

    @rawkode #scotphp17 From Monolith to Micro-services ★ Confidence ★ Scalability

    ★ Idempotence ★ Understanding ★ Super Mind Reading Abilities ★ Agility
  21. 60.

    @rawkode #scotphp17 Service Mesh (istio edition) Connect, Manage & Secure

    your services ➔ Load Balancing ➔ Canaries ➔ Circuit Breakers ➔ Handling Timeouts and Retries ➔ Fault Injection ➔ mTLS
  22. 61.

    @rawkode #scotphp17 Service Mesh (istio edition) Load Balancing source: name:

    user-service labels: version: v3 destination: name: email-service labels: version: v1 loadBalancing: name: ROUND_ROBIN
  23. 62.

    @rawkode #scotphp17 Service Mesh (istio edition) Load Balancing Canaries destination:

    name: user-service route: - labels: version: v2 weight: 25 - labels: version: v1 weight: 75
  24. 64.

    @rawkode #scotphp17 Service Mesh (istio edition) Timeouts & Retries httpReqTimeout:

    simpleTimeout: timeout: 10s httpReqRetries: simpleRetry: attempts: 3
  25. 65.

    @rawkode #scotphp17 Service Mesh (istio edition) Fault Injection httpFault: delay:

    percent: 10 fixedDelay: 5s abort: percent: 2 httpStatus: 400