Top Banner
Containerizing the Cloud with Kubernetes and Docker James Chittenden Cloud Platform Solutions Engineer [email protected]
28

Containerizing the Cloud with Kubernetes and Docker

Apr 14, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Containerizing the Cloud with Kubernetes and Docker

Containerizing the Cloudwith Kubernetes and Docker

James ChittendenCloud Platform Solutions [email protected]

Page 2: Containerizing the Cloud with Kubernetes and Docker

What is a container?• Lightweight Linux environment

• Hermetically sealed, deployable application

• Introspectable, runnable artifact

• Recently popularized by Docker

Page 3: Containerizing the Cloud with Kubernetes and Docker

Static application environment = reliable deployments

No stress deployment and update

Why do developers care?

Repeatable, runnable artifact = portability

Develop here, run therePick your cloud solely on its merits

Loosely coupled = easier to build and manage

Compose applications from micro-services

Mix in and extend third party services

Page 4: Containerizing the Cloud with Kubernetes and Docker

Everything at Google runs in a container.

• Resource isolation

• Predictability

• Quality of service

• Efficient overcommit

• Resource accounting

Images by Connie Zhou

Page 5: Containerizing the Cloud with Kubernetes and Docker

We start over 2 billion containers per week.

Page 6: Containerizing the Cloud with Kubernetes and Docker

Why do developers care?

• Efficiency: optimized packing, better scaling

• Performance: active environment tuning

• Continuous integration: easy and reliable

• Robustness: active monitoring, self healing

Highly automatable = path to active management

Page 7: Containerizing the Cloud with Kubernetes and Docker

Managed Base OS

Node Container Manager

Scheduled Containers

Cluster Scheduler

Google cluster management stack

Page 8: Containerizing the Cloud with Kubernetes and Docker

Managed Base OS

Node Container Manager

Scheduled Containers

Cluster Scheduler

Node container management on the Google Cloud

Container Optimized VM Image

Standardized Declarative Container Manifest

Container health monitoring and restart

Page 9: Containerizing the Cloud with Kubernetes and Docker

version: v1beta1

containers:

- name: www

image: nginx

ports:

- name: http

hostPort: 8080

containerPort: 80

Example with nginx$ gcloud compute instances create my-nginx-container

--metadata-from-file google-container-manifest=containers.yaml

--zone us-central1-a

--machine-type f1-micro

--image projects/google-containers/global/images/container-vm-v20140522

command line

containers.yaml

www

Page 10: Containerizing the Cloud with Kubernetes and Docker

version: v1beta1

containers:

- name: www

image: nginx

ports:

- name: http

hostPort: 8080

containerPort: 80

- name: https

hostPort: 443

containerPort: 443

Example with nginx

containers.yaml

www8080

443

80

443

Page 11: Containerizing the Cloud with Kubernetes and Docker

version: v1beta1

containers:

- name: www

volumeMounts:

- name: dataShard

path: /mnt/shard

readOnly: true

- name: dataLoader

volumeMounts:

- name: dataShard

path: /mnt/output

volumes:

- name: dataShard

Example with data shardingcontainers.yaml

www dataLoader

dataShard

Page 12: Containerizing the Cloud with Kubernetes and Docker

User Experience

Container Env.

User App

Host GCE VM

Google Provided

OS

monitoring agent

logging agent

init / systemd sshd

docker

Page 13: Containerizing the Cloud with Kubernetes and Docker

Managed Base OS

Node Container Manager

Scheduled Containers

Cluster Scheduler

Cluster container scheduling on the Google Cloud

Schedule containers across machines

Replication and resizing

Service naming and discovery

Page 14: Containerizing the Cloud with Kubernetes and Docker

But it takes a community...

Containers are portable. The active management framework must be portable too:

• Run on your development machine.• Run on your cloud. • Run on Google Cloud Platform.• Run a different provider or your own hardware.

And it must be enterprise grade.

The community is working to create a framework that runs well everywhere: Kubernetes

Microsoft, IBM, Red Hat, Docker, Mesosphere, SaltStack, andCoreOS, have joined the family.

Page 15: Containerizing the Cloud with Kubernetes and Docker

Kubernetes κυβερνήτης: Greek for “pilot” or “helmsman of a ship”

the open source cluster manager from Google

Page 16: Containerizing the Cloud with Kubernetes and Docker

KubernetesMaster/Scheduler

Kubernetes

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Page 17: Containerizing the Cloud with Kubernetes and Docker

Log Roller

Web Server

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

KubernetesMaster/Scheduler

Pods

Page 18: Containerizing the Cloud with Kubernetes and Docker

FE

FE

FE

FE

FE

FE

BE

BE

BE BEBE

BE

BEBE

BE

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Kubernetes - Master/Scheduler

Too Many Pods

Page 19: Containerizing the Cloud with Kubernetes and Docker

labels: role: frontend

FE

FE

FE

FE

FE

FE

BE

BE

BE BEBE

BE

BEBE

BE

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Kubernetes - Master/Scheduler

Labels

Page 20: Containerizing the Cloud with Kubernetes and Docker

labels: role: frontend stage: production

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Kubernetes - Master/Scheduler

FE

FE

FE

FE

FE

FE

BE

BE

BE BEBE

BE

BEBE

BE

Labels

Page 21: Containerizing the Cloud with Kubernetes and Docker

FE FE FE FE

replicas: 4template: ...labels: role: frontend stage: production

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Kubernetes - Master/Scheduler

Replica Controller

Page 22: Containerizing the Cloud with Kubernetes and Docker

FE

replicas: 1template: ...labels: role: frontend stage: production

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Kubernetes - Master/Scheduler

Replica Controller

Page 23: Containerizing the Cloud with Kubernetes and Docker

FE FE FE

replicas: 3template: ...labels: role: frontend stage: production

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Kubernetes - Master/Scheduler

Replica Controller

Page 24: Containerizing the Cloud with Kubernetes and Docker

id: backend-serviceport: 9000labels: role: backend stage: production

Backend Service

BE BE BE BE

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

MachineHost

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

ContainerAgent

Kubernetes - Master/Scheduler

Service

Page 25: Containerizing the Cloud with Kubernetes and Docker

Live Demo!Live Demo!

Page 26: Containerizing the Cloud with Kubernetes and Docker

We’re just getting started

● Clone Kubernetes at: https://github.com/GoogleCloudPlatform/kubernetes

● Check out container VMs at:https://developers.google.com/compute/docs/containers

● Join the discussion on freenode:http://webchat.freenode.net/?channels=google-containers

Page 27: Containerizing the Cloud with Kubernetes and Docker

We’re taking lessons we’ve learned and open sourcing them

Kubernetes is our evolving effort to make cluster management easy

We’re eager to hear from you!

1

2

3

Summary

Page 28: Containerizing the Cloud with Kubernetes and Docker

End