Slide 1

Slide 1 text

Kubernetes & Container Engine Sandeep Parikh Solutions Architect @crcsmnky

Slide 2

Slide 2 text

2 Google Cloud Platform Container Challenges “If we run our containers on VMs, I don’t want to manage anything” “How do I get my containers to talk to one another?” “Where should I run my containers? “How do we ensure our containers are running smoothly?”

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Google launches over 2 billion containers each week

Slide 5

Slide 5 text

Kubernetes is based on years of experience running containers at scale

Slide 6

Slide 6 text

6 Google Cloud Platform ● Run and manage a cluster of containers as a single system ● Orchestrate containers by scheduling on to cluster nodes ● Ensure state and group into units for management and discovery ● Open source and developed in the open ● Driven by the community http://cncf.io ● Deployable everywhere Kubernetes

Slide 7

Slide 7 text

7 CNCF

Slide 8

Slide 8 text

Confidential & Proprietary Google Cloud Platform 8 Building Blocks

Slide 9

Slide 9 text

9 Google Cloud Platform cluster

Slide 10

Slide 10 text

10 Google Cloud Platform cluster virtual machines that Kubernetes manages

Slide 11

Slide 11 text

11 Google Cloud Platform cluster node master node node

Slide 12

Slide 12 text

12 Google Cloud Platform cluster node master node node node node node node node node node node node node node node node node node node node node cluster

Slide 13

Slide 13 text

13 Google Cloud Platform pod

Slide 14

Slide 14 text

14 Google Cloud Platform pod group of containers sharing storage and network pod

Slide 15

Slide 15 text

15 Google Cloud Platform pod.yaml apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80 pod.yaml

Slide 16

Slide 16 text

16 Google Cloud Platform pod.yaml node master node node pod.yaml

Slide 17

Slide 17 text

17 Google Cloud Platform pod.yaml node master node node pod.yaml

Slide 18

Slide 18 text

18 Google Cloud Platform pod.yaml node master node node pod.yaml

Slide 19

Slide 19 text

19 Google Cloud Platform replication controller

Slide 20

Slide 20 text

20 Google Cloud Platform replication controller ensure N pods are running replication controller

Slide 21

Slide 21 text

21 Google Cloud Platform rc.yaml kind: ReplicationController apiVersion: v1 metadata: name: frontend spec: replicas: 4 selector: role: www template: metadata: name: www labels: role: www spec: containers: - name: nginx image: nginx ports: - containerPort: 80 rc.yaml

Slide 22

Slide 22 text

22 Google Cloud Platform rc.yaml kind: ReplicationController apiVersion: v1 metadata: name: frontend spec: replicas: 4 selector: role: www template: metadata: name: www labels: role: www spec: containers: - name: nginx image: nginx ports: - containerPort: 80 rc.yaml

Slide 23

Slide 23 text

23 Google Cloud Platform rc.yaml kind: ReplicationController apiVersion: v1 metadata: name: frontend spec: replicas: 4 selector: role: www template: metadata: name: www labels: role: www spec: containers: - name: nginx image: nginx ports: - containerPort: 80 rc.yaml

Slide 24

Slide 24 text

24 Google Cloud Platform rc.yaml kind: ReplicationController apiVersion: v1 metadata: name: frontend spec: replicas: 4 selector: role: www template: metadata: name: www labels: role: www spec: containers: - name: nginx image: nginx ports: - containerPort: 80 rc.yaml

Slide 25

Slide 25 text

25 Google Cloud Platform rc.yaml node master node node rc.yaml

Slide 26

Slide 26 text

26 Google Cloud Platform rc.yaml node master node node rc.yaml

Slide 27

Slide 27 text

27 Google Cloud Platform node master node node rc.yaml rc.yaml

Slide 28

Slide 28 text

Confidential & Proprietary Google Cloud Platform 28 How do we connect to the pods?

Slide 29

Slide 29 text

29 Google Cloud Platform service service

Slide 30

Slide 30 text

30 Google Cloud Platform service abstraction to communicate with pods service

Slide 31

Slide 31 text

31 Google Cloud Platform service master service service

Slide 32

Slide 32 text

32 Google Cloud Platform service master service service

Slide 33

Slide 33 text

33 Google Cloud Platform service master service service service

Slide 34

Slide 34 text

34 Google Cloud Platform service master service public load balancer service service

Slide 35

Slide 35 text

35 Google Cloud Platform svc.yaml kind: Service apiVersion: v1 metadata: name: www-frontend spec: ports: - name: http port: 80 targetPort: 80 protocol: TCP selector: role: www type: LoadBalancer svc.yaml

Slide 36

Slide 36 text

36 Google Cloud Platform svc.yaml kind: Service apiVersion: v1 metadata: name: www-frontend spec: ports: - name: http port: 80 targetPort: 80 protocol: TCP selector: role: www type: LoadBalancer svc.yaml

Slide 37

Slide 37 text

37 Google Cloud Platform svc.yaml kind: Service apiVersion: v1 metadata: name: www-frontend spec: ports: - name: http port: 80 targetPort: 80 protocol: TCP selector: role: www type: LoadBalancer svc.yaml

Slide 38

Slide 38 text

Confidential & Proprietary Google Cloud Platform 38 Container Engine

Slide 39

Slide 39 text

39 Google Cloud Platform Google Container Engine Hosted Kubernetes with managed resources Run clusters on a bundle of Google Compute Engine resources: Instances, Disks, Networking, Load Balancer Built-in support for centralized logging and container health checking Private container registry at gcr.io

Slide 40

Slide 40 text

Confidential & Proprietary Google Cloud Platform 40 What’s New

Slide 41

Slide 41 text

41 Google Cloud Platform New in Kubernetes 1.1 ● Ingress (L7) ● iptables kube-proxy ● ConfigMaps ● Deployments ● Jobs ● DaemonSets ● Graceful Termination ● Horizontal Pod Autoscaling ● Cluster Node Scaling

Slide 42

Slide 42 text

42 Google Cloud Platform Ingress Services are assumed L3/L4 Lots of apps want HTTP/HTTPS Ingress maps incoming traffic to backend services • by HTTP host headers • by HTTP URL paths HAProxy, NGINX, AWS and GCE implementations in progress Now with SSL! Status: BETA in Kubernetes v1.2 URL Map Client

Slide 43

Slide 43 text

43 Google Cloud Platform iptables kube-proxy

Slide 44

Slide 44 text

44 Google Cloud Platform ConfigMaps Problem: how to manage app configuration • ...without making overly-brittle container images 12-factor says config comes from the environment • Kubernetes is the environment Manage config via the Kubernetes API Inject config as a virtual volume into your Pods • late-binding, live-updated (atomic) • also available as env vars Status: GA in Kubernetes v1.2 node API Pod Config Map

Slide 45

Slide 45 text

45 Google Cloud Platform Deployments Rolling update is too imperative Deployment manages RC changes for you • stable object name • updates are done server-side rather than client • kubectl edit or kubectl apply is all you need Aggregates stats Can have multiple updates in flight Status: BETA in Kubernetes v1.2 ...

Slide 46

Slide 46 text

46 Google Cloud Platform Jobs Run-to-completion, as opposed to run-forever • Express parallelism vs. required completions • Workflow: restart on failure • Build/test: don’t restart on failure Aggregates success/failure counts Built for batch and big-data work Status: GA in Kubernetes v1.2 ...

Slide 47

Slide 47 text

47 Google Cloud Platform Daemon Sets Problem: how to run a Pod on every node • or a subset of nodes Similar to ReplicationController • principle: do one thing, don’t overload “Which nodes?” is a selector Use familiar tools and patterns Status: BETA in Kubernetes v1.2 Pod

Slide 48

Slide 48 text

48 Google Cloud Platform Graceful Termination Give pods time to clean up • finish in-flight operations • log state • flush to disk • 30 seconds by default Catch SIGTERM, cleanup, exit ASAP Pod status “Terminating” Declarative: ‘DELETE’ manifests as an object field in the API

Slide 49

Slide 49 text

49 Google Cloud Platform HorizontalPodAutoScalers Automatically scale ReplicationControllers to a target utilization • CPU utilization for now • Probably more later Operates within user-defined min/max bounds Set it and forget it Status: GA in Kubernetes v1.2 ... Stats

Slide 50

Slide 50 text

50 Google Cloud Platform Cluster Scaling Add nodes when needed • e.g. CPU usage too high • nodes self-register with API server Remove nodes when not needed • e.g. CPU usage too low Status: Works on GCE, need other implementations ...

Slide 51

Slide 51 text

Confidential & Proprietary Google Cloud Platform 51 Coming Soon

Slide 52

Slide 52 text

52 Google Cloud Platform Coming Soon • Cron (scheduled jobs) • Custom metrics • “Apply” a config (even more declarative) • Interactive containers • Bandwidth shaping • Third-party API objects • Scalability: 1000 nodes, 100+ pods/node • Performance • Machine-generated Go clients (less deps!) • Volume usage stats • Multi-zone (AZ) support • Multi-scheduler support • Node affinity and anti-affinity • Multi-cluster federation • API federation • More volume types • Private Docker registry • External DNS integration • Volume classes and auto-provisioning • Node fencing • DiY Cloud Provider plugins • More container runtimes (e.g. Hyper) • Better auth{n,z} • Network policy (micro-segmentation) • Big data integrations • Device scheduling (e.g. GPUs)

Slide 53

Slide 53 text

53 Google Cloud Platform Kubernetes Status and Plans Open sourced in June, 2014 • v1.0 in July, 2015 • v1.1 in November, 2015 • v1.2 ... soon! Google Container Engine (GKE) • hosted Kubernetes - don’t think about cluster setup PaaSes: • RedHat OpenShift, Deis, Stratos Distros: • CoreOS Tectonic, Mirantis Murano (OpenStack),RedHat Atomic, Mesos Hitting a ~3 month release cadence

Slide 54

Slide 54 text

Thanks!