What Even is Cloud Native? (PHPNE, April 2018)

What Even is Cloud Native? (PHPNE, April 2018)

What Even is Cloud Native? (ScotlandPHP 2017) by David McKay

Published November 7, 2017 in Technology

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

April 17, 2018
Tweet

Transcript

  1. 2.

    @rawkode David McKay Software Consultant ➔ User Group Organiser ◆

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

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

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

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

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

    @rawkode Microservices Oriented Applications are segmented into microservices. This significantly

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

    @rawkode // npm: is-even:1.0.0 if (i % 2 == 0)

    { return true; } return false;
  7. 21.

    @rawkode // is-odd:2.0.0 var isNumber = require('is-number'); module.exports = function

    isOdd(i) { if (!isNumber(i)) { throw new TypeError('is-odd expects a number.'); } if (Number(i) !== Math.floor(i)) { throw new RangeError('is-odd expects an integer.'); } return !!(~~i & 1); };
  8. 24.

    @rawkode Cloud Native Computing Foundation (CNCF) ★ Kubernetes ★ Prometheus

    ★ OpenTracing ★ Fluentd ★ Linkerd ★ gRPC ★ CoreDNS ★ containerd ★ rkt ★ CNI ★ Envoy ★ Jaeger
  9. 28.

    @rawkode apiVersion: extensions/v1beta1 kind: Deployment spec: replicas: 3 template: spec:

    containers: - name: my-container image: rawkode/my-container:sha256
  10. 40.

    @rawkode Fluent Bit Logging Written in C > 13k events

    per second ~ 450KIB RAM Footprint
  11. 41.

    @rawkode Fluentd/Bit Logging Plugins: ➔ AWS ➔ GCP ➔ MySQL

    / PostgreSQL ➔ Elasticsearch ➔ Docker ➔ Kubernetes ➔ Twitter ➔ Kafka
  12. 47.

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

    MongoDB ➔ RabbitMQ ➔ Kafka ➔ Apache ➔ Nginx ➔ Fluentd ➔ …
  13. 49.

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

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

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

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

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

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

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

    Parity ➔ Continuous Integration ➔ Automated Tests ➔ Automated Deployment
  18. 60.

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

    ➔ Explicit Dependencies ➔ JIT Configuration ➔ Build. Release. Run. ➔ Disposability
  19. 64.

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

    ➔ ssh prod ☹ ➔ Log to a central place ➔ Cross-sections ➔ Exception Tracking
  20. 66.
  21. 70.

    @rawkode 6. Micro-services Just don’t ask me to quantify “micro”

    ➔ Don’t refactor, replace ➔ Simplified testing ➔ Fast CI/Deploy ➔ Simple on-boarding
  22. 72.

    @rawkode From Monolith to Micro-services ★ Scaleable Horizontally ★ Idempotence

    ★ Intelligence ★ Intuition ★ Trust ★ Simplicity
  23. 73.
  24. 74.

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

    services ➔ Load Balancing ➔ Canaries ➔ Circuit Breakers ➔ Handling Timeouts and Retries ➔ Fault Injection ➔ mTLS
  25. 75.

    @rawkode Service Mesh (istio edition) Load Balancing source: name: user-service

    labels: version: v3 destination: name: email-service labels: version: v1 loadBalancing: name: ROUND_ROBIN
  26. 76.

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

    user-service route: - labels: version: v2 weight: 25 - labels: version: v1 weight: 75
  27. 78.
  28. 79.

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

    10 fixedDelay: 5s abort: percent: 2 httpStatus: 400
  29. 84.