Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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. @rawkode #scotphp17 What Even is Cloud Native? ScotlandPHP 2017

  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
  3. @rawkode #scotphp17 Cloud Native Klaʊd Neɪtɪv adjective: cloud-native, superlative adjective:

    cloud-nativest ???
  4. @rawkode #scotphp17 Cloud Klaʊd

  5. @rawkode #scotphp17 Cloud Klaʊd

  6. @rawkode #scotphp17 Cloud Klaʊd * To all the OCD types

    out there, I’m sorry
  7. @rawkode #scotphp17 Cloud Native Computing Foundation (CNCF)

  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.
  9. @rawkode #scotphp17 Containerized “Each part (applications, processes, etc) is packaged

    in its own container. This facilitates reproducibility, transparency, and resource isolation”
  10. @rawkode #scotphp17 Containerized: Reproducibility

  11. @rawkode #scotphp17 Containerized: Resource Isolation

  12. @rawkode #scotphp17 Containerized: Transparency

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

    apk add php ENTRYPOINT [ “php” ] CMD [“-v”]
  14. @rawkode #scotphp17 Dynamically Orchestrated Containers are actively scheduled and managed

    to optimize resource utilization
  15. @rawkode #scotphp17 Dynamically Orchestrated

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

    significantly increases the overall agility and maintainability of applications.
  17. @rawkode #scotphp17 Microservices Oriented

  18. @rawkode #scotphp17 I’m sold. What do I need?

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

    Prometheus ★ OpenTracing ★ Fluentd ★ Linkerd ★ gRPC ★ CoreDNS ★ containerd ★ rkt ★ CNI ★ Envoy ★ Jaeger
  20. @rawkode #scotphp17 Kubernetes Orchestration

  21. @rawkode #scotphp17 Kubernetes Orchestration Terrence @ 1530

  22. @rawkode #scotphp17 Fluentd Logging

  23. @rawkode #scotphp17 Fluentd Logging Written in C & Ruby

  24. @rawkode #scotphp17 Fluentd Logging 13k events per second ~ 40MB

    RAM Footprint
  25. @rawkode #scotphp17 Fluent Bit Logging

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

    events per second ~ 450KIB RAM Footprint
  27. @rawkode #scotphp17 Fluentd/Bit Logging Plugins: ➔ AWS ➔ GCP ➔

    MySQL / PostgreSQL ➔ Elasticsearch ➔ Docker ➔ Kubernetes ➔ Twitter ➔ Kafka
  28. @rawkode #scotphp17 Fluentd/Bit Docker Logging { “log-driver": "fluentd", "log-opts": {

    "fluentd-address": “...” } }
  29. @rawkode #scotphp17 Fluentd/Bit Kubernetes Logging # DaemonSet image: quay.io /fluent

    /fluentd-kubernetes-daemonset
  30. @rawkode #scotphp17 Prometheus Monitoring

  31. @rawkode #scotphp17 Prometheus Monitoring Written in Go

  32. @rawkode #scotphp17 Prometheus Monitoring Provides Dashboards & Works with Grafana

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

    ➔ MongoDB ➔ RabbitMQ ➔ Kafka ➔ Apache ➔ Nginx ➔ Fluentd ➔ …
  34. @rawkode #scotphp17 Prometheus Monitoring Scraping Magic with Kubernetes ➔ /metrics

    my_metric{label=a} 1 my_metric{label=b} 6
  35. @rawkode #scotphp17 Prometheus Monitoring Manual Instrumentation $counter = newCounter([ 'namespace'

    => 'myApp', 'subsystem' => 'Prod', 'name' => 'httpRequests', ]); $counter->increment( ['url' => '/login', 'status_code' => 200 ], 1);
  36. @rawkode #scotphp17 Prometheus Monitoring Manual Instrumentation $counter = newCounter([ 'namespace'

    => 'myApp', 'subsystem' => 'Prod', 'name' => 'httpRequests', ]); $counter->increment( ['url' => '/login', 'status_code' => 200 ], 1);
  37. @rawkode #scotphp17 Prometheus Monitoring Manual Instrumentation $counter = newCounter([ 'namespace'

    => 'myApp', 'subsystem' => 'Prod', 'name' => 'httpRequests', ]); $counter->increment( ['url' => '/login', 'status_code' => 200 ], 1);
  38. @rawkode #scotphp17 OpenTracing Tracing

  39. @rawkode #scotphp17 OpenTracing Tracing A vendor-neutral open standard for distributed

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

    JavaScript, Java, Python, Ruby, PHP, Objective-C, C++, C#
  41. @rawkode #scotphp17 OpenTracing Tracing Why?

  42. @rawkode #scotphp17

  43. @rawkode #scotphp17 From Monolith to Cloud Native The 12 6-Step

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

    Continuous Integration ➔ Automated Tests ➔ Automated Deployment
  45. @rawkode #scotphp17 Confidence

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

    Control ➔ Explicit Dependencies ➔ Environment Based Config ◆ Runtime Injection Preferred ➔ Build. Release. Run. ➔ Disposability
  47. @rawkode #scotphp17 Scalability

  48. @rawkode #scotphp17 3. Adopt Containers Repeatable Deployments

  49. @rawkode #scotphp17 Environment Parity / Repeatability

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

    Logging ➔ ssh prod ☹ ➔ Log to a central place ➔ Cross-sections ➔ Exception Tracking
  51. @rawkode #scotphp17 Understanding

  52. @rawkode #scotphp17 5. Monitoring Predicting when something will go wrong

    Be the first to know when a service is down
  53. @rawkode #scotphp17 5. Monitoring Predicting when something will go wrong

    Understand your limits / Scale accordingly
  54. @rawkode #scotphp17 5. Monitoring Predicting when something will go wrong

    Don’t DDOS Yourself
  55. @rawkode #scotphp17 Psychic Abilities

  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
  57. @rawkode #scotphp17 Agility

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

    ★ Idempotence ★ Understanding ★ Super Mind Reading Abilities ★ Agility
  59. @rawkode #scotphp17 One More Thing …

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

    your services ➔ Load Balancing ➔ Canaries ➔ Circuit Breakers ➔ Handling Timeouts and Retries ➔ Fault Injection ➔ mTLS
  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
  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
  63. @rawkode #scotphp17 Service Mesh (istio edition) Circuit Breakers circuitBreaker: simpleCb:

    maxConnections: 100
  64. @rawkode #scotphp17 Service Mesh (istio edition) Timeouts & Retries httpReqTimeout:

    simpleTimeout: timeout: 10s httpReqRetries: simpleRetry: attempts: 3
  65. @rawkode #scotphp17 Service Mesh (istio edition) Fault Injection httpFault: delay:

    percent: 10 fixedDelay: 5s abort: percent: 2 httpStatus: 400
  66. @rawkode #scotphp17 But wait, there’s more!

  67. @rawkode #scotphp17 OpenTracing Automatic Tracing of gRPC & HTTP requests

  68. @rawkode #scotphp17 mTLS Automatic mTLS between service requests

  69. @rawkode #scotphp17 When will I know I’m there?

  70. @rawkode #scotphp17

  71. @rawkode #scotphp17 You are now Cloud Native https://joind.in/talk/d22c7i