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

What Even is Cloud Native? (ScotlandPHP 2017)

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?"

David McKay

November 07, 2017
Tweet

More Decks by David McKay

Other Decks in Technology

Transcript

  1. @rawkode #scotphp17
    What Even is Cloud Native?
    ScotlandPHP 2017

    View Slide

  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

    View Slide

  3. @rawkode #scotphp17
    Cloud Native
    Klaʊd Neɪtɪv
    adjective: cloud-native, superlative adjective: cloud-nativest
    ???

    View Slide

  4. @rawkode #scotphp17
    Cloud
    Klaʊd

    View Slide

  5. @rawkode #scotphp17
    Cloud
    Klaʊd

    View Slide

  6. @rawkode #scotphp17
    Cloud
    Klaʊd
    * To all the OCD types out there, I’m sorry

    View Slide

  7. @rawkode #scotphp17
    Cloud Native Computing Foundation
    (CNCF)

    View Slide

  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.

    View Slide

  9. @rawkode #scotphp17
    Containerized
    “Each part (applications, processes, etc) is packaged in its own container. This
    facilitates reproducibility, transparency, and resource isolation”

    View Slide

  10. @rawkode #scotphp17
    Containerized: Reproducibility

    View Slide

  11. @rawkode #scotphp17
    Containerized: Resource Isolation

    View Slide

  12. @rawkode #scotphp17
    Containerized: Transparency

    View Slide

  13. @rawkode #scotphp17
    Containerized: Transparency
    FROM alpine:3.5
    RUN apk update && apk add php
    ENTRYPOINT [ “php” ]
    CMD [“-v”]

    View Slide

  14. @rawkode #scotphp17
    Dynamically Orchestrated
    Containers are actively scheduled and managed to optimize resource utilization

    View Slide

  15. @rawkode #scotphp17
    Dynamically Orchestrated

    View Slide

  16. @rawkode #scotphp17
    Microservices Oriented
    Applications are segmented into microservices. This significantly increases the
    overall agility and maintainability of applications.

    View Slide

  17. @rawkode #scotphp17
    Microservices Oriented

    View Slide

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

    View Slide

  19. @rawkode #scotphp17
    Cloud Native Computing Foundation (CNCF)
    ★ Kubernetes
    ★ Prometheus
    ★ OpenTracing
    ★ Fluentd
    ★ Linkerd
    ★ gRPC
    ★ CoreDNS
    ★ containerd
    ★ rkt
    ★ CNI
    ★ Envoy
    ★ Jaeger

    View Slide

  20. @rawkode #scotphp17
    Kubernetes
    Orchestration

    View Slide

  21. @rawkode #scotphp17
    Kubernetes
    Orchestration
    Terrence
    @
    1530

    View Slide

  22. @rawkode #scotphp17
    Fluentd
    Logging

    View Slide

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

    View Slide

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

    View Slide

  25. @rawkode #scotphp17
    Fluent Bit
    Logging

    View Slide

  26. @rawkode #scotphp17
    Fluent Bit
    Logging
    Written in
    C
    > 13k events per second
    ~ 450KIB RAM Footprint

    View Slide

  27. @rawkode #scotphp17
    Fluentd/Bit
    Logging
    Plugins:
    ➔ AWS
    ➔ GCP
    ➔ MySQL / PostgreSQL
    ➔ Elasticsearch
    ➔ Docker
    ➔ Kubernetes
    ➔ Twitter
    ➔ Kafka

    View Slide

  28. @rawkode #scotphp17
    Fluentd/Bit
    Docker Logging
    { “log-driver": "fluentd",
    "log-opts": {
    "fluentd-address": “...”
    }
    }

    View Slide

  29. @rawkode #scotphp17
    Fluentd/Bit
    Kubernetes Logging
    # DaemonSet
    image:
    quay.io
    /fluent
    /fluentd-kubernetes-daemonset

    View Slide

  30. @rawkode #scotphp17
    Prometheus
    Monitoring

    View Slide

  31. @rawkode #scotphp17
    Prometheus
    Monitoring
    Written in
    Go

    View Slide

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

    View Slide

  33. @rawkode #scotphp17
    Prometheus
    Monitoring
    Export Everything!
    ➔ Elasticsearch
    ➔ Consul
    ➔ MongoDB
    ➔ RabbitMQ
    ➔ Kafka
    ➔ Apache
    ➔ Nginx
    ➔ Fluentd
    ➔ …

    View Slide

  34. @rawkode #scotphp17
    Prometheus
    Monitoring
    Scraping
    Magic with Kubernetes
    ➔ /metrics
    my_metric{label=a} 1
    my_metric{label=b} 6

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  38. @rawkode #scotphp17
    OpenTracing
    Tracing

    View Slide

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

    View Slide

  40. @rawkode #scotphp17
    OpenTracing
    Tracing
    Libraries available in 9
    languages:
    Go, JavaScript, Java, Python,
    Ruby, PHP, Objective-C, C++, C#

    View Slide

  41. @rawkode #scotphp17
    OpenTracing
    Tracing
    Why?

    View Slide

  42. @rawkode #scotphp17

    View Slide

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

    View Slide

  44. @rawkode #scotphp17
    1. Automation
    DevOps isn’t just a buzzword
    ➔ Continuous Integration
    ➔ Automated Tests
    ➔ Automated Deployment

    View Slide

  45. @rawkode #scotphp17
    Confidence

    View Slide

  46. @rawkode #scotphp17
    2. 12-Factor
    Build Once. Deploy Anywhere.
    ➔ Version Control
    ➔ Explicit Dependencies
    ➔ Environment Based Config
    ◆ Runtime Injection Preferred
    ➔ Build. Release. Run.
    ➔ Disposability

    View Slide

  47. @rawkode #scotphp17
    Scalability

    View Slide

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

    View Slide

  49. @rawkode #scotphp17
    Environment Parity /
    Repeatability

    View Slide

  50. @rawkode #scotphp17
    4. Logging
    Understanding what is going
    wrong
    Centralised Logging
    ➔ ssh prod ☹
    ➔ Log to a central place
    ➔ Cross-sections
    ➔ Exception Tracking

    View Slide

  51. @rawkode #scotphp17
    Understanding

    View Slide

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

    View Slide

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

    View Slide

  54. @rawkode #scotphp17
    5. Monitoring
    Predicting when something will go
    wrong
    Don’t DDOS Yourself

    View Slide

  55. @rawkode #scotphp17
    Psychic Abilities

    View Slide

  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

    View Slide

  57. @rawkode #scotphp17
    Agility

    View Slide

  58. @rawkode #scotphp17
    From Monolith to
    Micro-services
    ★ Confidence
    ★ Scalability
    ★ Idempotence
    ★ Understanding
    ★ Super Mind Reading Abilities
    ★ Agility

    View Slide

  59. @rawkode #scotphp17
    One More Thing …

    View Slide

  60. @rawkode #scotphp17
    Service Mesh
    (istio edition)
    Connect, Manage & Secure your
    services
    ➔ Load Balancing
    ➔ Canaries
    ➔ Circuit Breakers
    ➔ Handling Timeouts and Retries
    ➔ Fault Injection
    ➔ mTLS

    View Slide

  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

    View Slide

  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

    View Slide

  63. @rawkode #scotphp17
    Service Mesh
    (istio edition)
    Circuit Breakers
    circuitBreaker:
    simpleCb:
    maxConnections: 100

    View Slide

  64. @rawkode #scotphp17
    Service Mesh
    (istio edition)
    Timeouts
    &
    Retries
    httpReqTimeout:
    simpleTimeout:
    timeout: 10s
    httpReqRetries:
    simpleRetry:
    attempts: 3

    View Slide

  65. @rawkode #scotphp17
    Service Mesh
    (istio edition)
    Fault Injection
    httpFault:
    delay:
    percent: 10
    fixedDelay: 5s
    abort:
    percent: 2
    httpStatus: 400

    View Slide

  66. @rawkode #scotphp17
    But wait, there’s more!

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  70. @rawkode #scotphp17

    View Slide

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

    View Slide