Slide 1

Slide 1 text

cluster management, cognitive shifts, &
 kubernetes seattle.rb @juliaferraioli, kubernautical advocate

Slide 2

Slide 2 text

cluster management with Borg

Slide 3

Slide 3 text

cluster management 
 
 with Borg the system we internally call

Slide 4

Slide 4 text

@juliaferraioli Image by Connie Zhou

Slide 5

Slide 5 text

@juliaferraioli developer view

Slide 6

Slide 6 text

@juliaferraioli job hello_world = { developer view

Slide 7

Slide 7 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in developer view

Slide 8

Slide 8 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run developer view

Slide 9

Slide 9 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters developer view

Slide 10

Slide 10 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements developer view

Slide 11

Slide 11 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M developer view

Slide 12

Slide 12 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M developer view

Slide 13

Slide 13 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 developer view

Slide 14

Slide 14 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 } developer view

Slide 15

Slide 15 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 } replicas = 5 // Number of tasks developer view

Slide 16

Slide 16 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 } replicas = 5 // Number of tasks } developer view

Slide 17

Slide 17 text

@juliaferraioli job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 } replicas = 5 // Number of tasks } 10000 developer view

Slide 18

Slide 18 text

@juliaferraioli Image by Connie Zhou Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!

Slide 19

Slide 19 text

@juliaferraioli Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Image by Connie Zhou Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!

Slide 20

Slide 20 text

@juliaferraioli developer view

Slide 21

Slide 21 text

@juliaferraioli developer view

Slide 22

Slide 22 text

@juliaferraioli task-eviction rates and causes failures

Slide 23

Slide 23 text

@juliaferraioli advanced bin- packing algorithms experimental placement of production VM workload, July 2014 one
 machine efficiency

Slide 24

Slide 24 text

@juliaferraioli advanced bin- packing algorithms experimental placement of production VM workload, July 2014 available resources one
 machine efficiency

Slide 25

Slide 25 text

@juliaferraioli advanced bin- packing algorithms experimental placement of production VM workload, July 2014 stranded resources available resources one
 machine efficiency

Slide 26

Slide 26 text

@juliaferraioli Borg paper: http://goo.gl/1C4nuo Images by Connie Zhou observations: 1. resiliency is achieved only by ruthless attention to detail a. ubiquitous software fault tolerance b. persistent, declarative specs
 2. we get efficiency by: a. sharing resources b. reclaiming unused allocations 1. containers make users more productive

Slide 27

Slide 27 text

@juliaferraioli app libs kernel libs app app kernel app libs libs kernel kernel not so long ago: virtual machines

Slide 28

Slide 28 text

@juliaferraioli libs app kernel libs app libs app libs app the new kid in town: containers

Slide 29

Slide 29 text

A fundamentally different way of managing applications

Slide 30

Slide 30 text

enter kubernetes, stage center

Slide 31

Slide 31 text

@juliaferraioli κυβερνήτης: “Helmsman”; root of “Governor” and “Cybernetic” manage applications, not machines kubernetes (or k8s)

Slide 32

Slide 32 text

demo, part 1

Slide 33

Slide 33 text

@juliaferraioli

Slide 34

Slide 34 text

@juliaferraioli demo overview Server Debian Docker Engine PHP libs Redis libs

Slide 35

Slide 35 text

@juliaferraioli A loop that drives current state towards desired state A small group of tightly coupled containers Pod Replication Controller Service A set of running pods that work together Arbitrary metadata to organize components Labels kubernetes cluster

Slide 36

Slide 36 text

@juliaferraioli Dashboard show: type = FE Object Pod frontend Object type = FE type = FE ● metadata with semantic meaning ● membership identifier ● the only grouping mechanism behavior benefits ➔ allow for intent of many users (e.g. dashboards) ➔ build higher level systems ➔ queryable by selectors labels

Slide 37

Slide 37 text

@juliaferraioli Dashboard show: type = FE Object Pod frontend Pod frontend Object Object Dashboard show: version = v2 type = FE version = v2 type = FE type = FE version = v2 ● metadata with semantic meaning ● membership identifier ● the only grouping mechanism behavior benefits ➔ allow for intent of many users (e.g. dashboards) ➔ build higher level systems ➔ queryable by selectors labels

Slide 38

Slide 38 text

@juliaferraioli A loop that drives current state towards desired state A set of running pods that work together Replication Controller Service Arbitrary metadata to organize components Labels A small group of tightly coupled containers Pod kubernetes cluster

Slide 39

Slide 39 text

@juliaferraioli small group of containers & volumes containers are tightly coupled the atom of cluster scheduling shared namespace • Shared network IP and port namespace ephemeral • can die and be replaced Pod Site generator Web Server Volume Consumers Content Manager pods

Slide 40

Slide 40 text

@juliaferraioli pods template:
 metadata:
 labels:
 name: frontend
 spec:
 containers:
 - name: php-redis
 image: kubernetes/example-guestbook-php-redis:v2
 ports:
 - containerPort: 80

Slide 41

Slide 41 text

@juliaferraioli A set of running pods that work together Service Arbitrary metadata to organize components Labels A small group of tightly coupled containers A loop that drives current state towards desired state Pod Replication Controller kubernetes cluster

Slide 42

Slide 42 text

@juliaferraioli Replication Controller Pod Pod frontend Pod frontend Pod Pod Replication Controller #pods = 1 version = v2 show: version = v2 version= v1 version = v1 version = v2 Replication Controller #pods = 2 version = v1 show: version = v2 Behavior Benefits ● keeps pods running ● gives direct control of pod #s ● grouped by label selector ➔ recreates pods, maintains desired state ➔ fine-grained control for scaling ➔ standard grouping semantics replication controllers

Slide 43

Slide 43 text

@juliaferraioli Replication Controller Replication Controller - Name = “frontend” - Selector = {“Name”: “frontend”} - PodTemplate = { ... } - NumReplicas = 3 API Server 2 Start 1 more OK 3 How many? How many? canonical example of control loops have one job: ensure N copies of a pod replicated pods are fungible replication controllers

Slide 44

Slide 44 text

@juliaferraioli replication controllers kind: ReplicationController
 metadata:
 name: frontend
 labels:
 name: frontend
 spec:
 replicas: 3
 selector:
 name: frontend
 template: $ kubectl create -f frontend-controller.yaml

Slide 45

Slide 45 text

@juliaferraioli kubernetes cluster Arbitrary metadata to organize components Labels A small group of tightly coupled containers A loop that drives current state towards desired state A set of running pods that work together Pod Replication Controller Service

Slide 46

Slide 46 text

@juliaferraioli Portal (VIP) Client Pod Container Container Container Container Pod Container Container Container Container Pod Container Container Container Container a group of pods that act as one == Service defines access policy gets a stable virtual IP and port VIP is captured by kube-proxy services

Slide 47

Slide 47 text

@juliaferraioli Service Label selectors: version = 1.0 type = Frontend Service Label selectors: version = v1 type = FE Replication Controller Pod Pod frontend Pod version= v1 version = v1 Replication Controller #pods = 2 show: version = v2 type = FE type = FE VIP services

Slide 48

Slide 48 text

@juliaferraioli services kind: Service
 metadata:
 name: frontend
 labels:
 name: frontend
 spec:
 type: LoadBalancer
 ports:
 - port: 80
 selector:
 name: frontend $ kubectl create -f frontend-service.yaml

Slide 49

Slide 49 text

...in technicolor! what’s doing what...

Slide 50

Slide 50 text

@juliaferraioli Master APIs Scheduling REST (pods, services, controllers) AuthN Scheduler Replication Controller Node3 Kubelet Proxy Pod Container Container Container Container Pod Container Container Container Container Node3 Kubelet Proxy Pod Container Container Container Container Pod Container Container Container Container Node1 Kubelet Proxy Pod Container Container Container Container Pod Container Container Container Container $ kubectl proxy --www=k8s-visualizer/ visualizing kubernetes

Slide 51

Slide 51 text

demo, part 2

Slide 52

Slide 52 text

@juliaferraioli

Slide 53

Slide 53 text

@juliaferraioli open sourced in June, 2014 Google launched Google Container Engine (GKE) • https://cloud.google.com/container-engine/ roadmap: • https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/roadmap.md where we are today http://www.kuberneteslaunch.com/

Slide 54

Slide 54 text

@juliaferraioli find us online… http://kubernetes.io https://github.com/GoogleCloudPlatform/kubernetes irc.freenode.net #google-containers @kubernetesio

Slide 55

Slide 55 text

@juliaferraioli thanks to... Brian Dorsey - Developer Advocate, Google Aja Hammerly - Developer Advocate, Google Amy Unruh - Developer Programs Engineer, Google Mandy Waite - Developer Advocate, Google John Wilkes - Principal Engineer, Google

Slide 56

Slide 56 text

https://flic.kr/p/6jk7ZL