Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

@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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

@rawkode #scotphp17 Cloud Klaʊd

Slide 5

Slide 5 text

@rawkode #scotphp17 Cloud Klaʊd

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

@rawkode #scotphp17 Cloud Native Computing Foundation (CNCF)

Slide 8

Slide 8 text

@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.

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

@rawkode #scotphp17 Containerized: Reproducibility

Slide 11

Slide 11 text

@rawkode #scotphp17 Containerized: Resource Isolation

Slide 12

Slide 12 text

@rawkode #scotphp17 Containerized: Transparency

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

@rawkode #scotphp17 Dynamically Orchestrated

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

@rawkode #scotphp17 Microservices Oriented

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

@rawkode #scotphp17 Kubernetes Orchestration

Slide 21

Slide 21 text

@rawkode #scotphp17 Kubernetes Orchestration Terrence @ 1530

Slide 22

Slide 22 text

@rawkode #scotphp17 Fluentd Logging

Slide 23

Slide 23 text

@rawkode #scotphp17 Fluentd Logging Written in C & Ruby

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

@rawkode #scotphp17 Fluent Bit Logging

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

@rawkode #scotphp17 Prometheus Monitoring

Slide 31

Slide 31 text

@rawkode #scotphp17 Prometheus Monitoring Written in Go

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

@rawkode #scotphp17 OpenTracing Tracing

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

@rawkode #scotphp17 OpenTracing Tracing Why?

Slide 42

Slide 42 text

@rawkode #scotphp17

Slide 43

Slide 43 text

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

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

@rawkode #scotphp17 Confidence

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

@rawkode #scotphp17 Scalability

Slide 48

Slide 48 text

@rawkode #scotphp17 3. Adopt Containers Repeatable Deployments

Slide 49

Slide 49 text

@rawkode #scotphp17 Environment Parity / Repeatability

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

@rawkode #scotphp17 Understanding

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

@rawkode #scotphp17 Psychic Abilities

Slide 56

Slide 56 text

@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

Slide 57

Slide 57 text

@rawkode #scotphp17 Agility

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

@rawkode #scotphp17 One More Thing …

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

@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

Slide 62

Slide 62 text

@rawkode #scotphp17 Service Mesh (istio edition) Load Balancing Canaries destination: name: user-service route: - labels: version: v2 weight: 25 - labels: version: v1 weight: 75

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

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

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

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

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

@rawkode #scotphp17 mTLS Automatic mTLS between service requests

Slide 69

Slide 69 text

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

Slide 70

Slide 70 text

@rawkode #scotphp17

Slide 71

Slide 71 text

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