Everything at Google (from Search to Gmail) runs in Linux Application Containers. Google is working with the Open Source community to bring over a decade of experience managing containers at scale to developers. Riccardo will talk through Kubernetes, a new Open Source container manager developed by Google with the help of the community. He will cover the core management patterns it supports, the problems it solves, and where things are going both with the project, and with the Google Cloud Platform service analogs. Kubernetes design: https://github.com/GoogleCloudPlatform/kubernetes/
Managed Containers, Open Source, and Google - Riccardo Carlesso - Codemotion Milan 2014
1. Kubernetes:
Managing Containers the Google way
CodeMotion Milan, 28 Nov 2014
Riccardo Carlesso
Technical Solution Engineer
ricc@google.com
http://goo.gl/3LpbZW
3. Static application environment
No stress deployment and update
Repeatable portable artifact
Develop here, run there
Pick your cloud solely on its merits
Loosely coupled
= easier to build and manage
Easier to build and manage
Compose applications from micro-services
Packaging
4. Everything at Google runs in a container.
• Resource isolation
• Predictability
• Quality of service
• Efficient overcommit
• Resource accounting
Google starts over 2 billion containers per week.
Images by Connie Zhou
Efficiency
5. Docker
● 15000+ GitHub stars
● 600+ contributors
● 100's of projects built on top of Docker
○ UIs, mini-PaaS, …
○ github.com/google/cadvisor
○ github.com/GoogleCloudPlatform/heapster
● Very popular GitHub project
○ Most popular Go project of all time
○ $ docker run -i -t ubuntu /bin/bash -p 80:80
7. Kubernetes
Inspired by Google's systems and experience:
Manage Containers, not Machines
Efficient & Robust:
• optimized packing
• active monitoring => self healing
Organizationally Scalable:
• Hassle-free maintanance =>
Enables micro-services
Modern Open Source:
• Written in Go
• Hosted on github
• Apache 2.0 licensed
8. Simplified Cluster Management Stack
Cluster Scheduler
Scheduled
Containers
Scheduled
Containers
Scheduled Containers
Node Container Manager
Node Container Manager
Managed Base OS
Managed Base OS
9. Kubernetes Container Stack
Kubernetes Master
etcd
Scheduled
Containers
Scheduled
Containers
Scheduled Containers
kubelet + Docker
kubelet
Managed Base OS
Managed Base OS
12. FE
FE
FE
FE
BE
FE
FE
BE
BE
BE
BE BE BE
BE
BE
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Kubernetes - Master/Scheduler
Too Many Pods
13. labels:
role: frontend
FE
FE
FE
FE
BE
FE
FE
BE
BE
BE
BE BE BE
BE
BE
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Kubernetes - Master/Scheduler
Labels
14. labels:
role: frontend
stage: production
Machine
Host
Machine
Host
Machine
Host
BE
Machine
Host
Machine
Host
BE
Machine
Host
Machine
Host
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Kubernetes - Master/Scheduler
FE
FE
FE
FE
FE
FE
BE
BE
BE BE BE
BE
BE
Labels
15. Replication Controller
FE FE FE FE
replicas: 4
template:
...
labels:
role: frontend
stage: production
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Kubernetes - Master/Scheduler
18. Declarative Over Imperative
Imperative:
"for pod in pod{001..100} ; start $pod
Declarative:
"Run 100 copies of this pod with a target of
<= 2 tasks down at any time"
Pros:
• Repeatable
• "Set it and forget it"
• Eventually consistent
• Easily updatable
Con:
• Tracing action/reaction can be difficult.
"I made a change, is it done?"
Image: "Space Needle under construction, 1961" seattlemunicipalarchives CC-BY-2.0 http://www.flickr.
com/photos/seattlemunicipalarchives/6847114249
19. id: backend-service
port: 9000
labels:
role: backend
stage: production
Pods are auto-placed: COOL!
but: How to direct FE->BE traffic ?
Backend Service
BE BE BE BE
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Machine
Host
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Container
Agent
Service
FE
port: 9000
Load-Balancing
Service proxy Service proxy Service proxy Service proxy Service proxy Service proxy
20. Demo (Guestbook)
Redis
Master
Finish
Master Service
Redis
Slave
Redis
Slave
Slave Service
PHP
Frontend
PHP
Frontend PHP
Frontend
23. We’re taking lessons we’ve learned and open sourcing them
Kubernetes is evolving
We’re eager to hear from you!
1
2
3
Summing Up
24. We are just getting started...
Clone Kubernetes at:
github.com/GoogleCloudPlatform/kubernetes
IRC: #google-containers on Freenode
Google group: google-containers
Reach out:
ricc@google.com
Kubernetes on GCE (new!): https://cloud.google.
com/compute/docs/containers
Presentation: http://goo.gl/3LpbZW