Google Cloud Platform
Running Cloud Native Apps on Kubernetes
Daniel Smith <dbsmith@google.com>
Sr. Software Engineer
@lavalamp on github
Google Cloud Platform
Kubernetes
Provides cluster management:
• Runs and manages containers
• Inspired and informed by Google’s experiences
and internal systems
• Supports multiple cloud and bare-metal
environments
• Supports multiple container runtimes
• 100% Open source, written in Go
Manage applications, not machines
Google Cloud Platform
Everything at Google runs in
containers:
• Gmail, Web Search, Maps, ...
• MapReduce, batch, ...
• GFS, Colossus, ...
• Even Google’s Cloud Platform:
our VMs run in containers!
We launch over 2 billion
containers per week
Google Cloud Platform
But it’s all so different!
• Deployment
• Management, monitoring
• Isolation (very complicated!)
• Updates
• Discovery
• Scaling, replication, sets
A fundamentally different way of
managing applications requires
different tooling and abstractions
Images by Connie Zhou
Google Cloud Platform
UI
All you really care about
Internet
Your App
Google Cloud Platform
12 factor
III. Config
• Store config in the environment
VI. Processes
• Execute the app as one or more stateless processes
VII. Port binding
• Export services via port binding
VIII. Concurrency
• Scale out via the process model
Cloud Native Apps
Google Cloud Platform
Pods
Google Cloud Platform
Pods
Small group of containers & volumes
Tightly coupled
The atom of scheduling & placement
Shared namespace
• share IP address & localhost
• share IPC, etc.
Managed lifecycle
• bound to a node, restart in place
• can die, cannot be reborn with same ID
Example: data puller & web server
Consumers
Content
Manager
File
Puller
Web
Server
Volume
Pod
Google Cloud Platform
Services
Google Cloud Platform
Services
A group of pods that work together
• grouped by a selector
Defines access policy
• “load balanced” or “headless”
Gets a stable virtual IP and port
• sometimes called the service portal
• also a DNS name
VIP is managed by Kubernetes
• App developer doesn’t have to think about it
Hides complexity - ideal for non-native apps
Client
Virtual IP
Google Cloud Platform
External Services
Services IPs are only available inside the
cluster
Need to receive traffic from “the outside
world”
Builtin: Service “type”
• nodePort: expose on a port on every node
• loadBalancer: provision a cloud load-balancer
DiY load-balancer solutions
• haproxy
• nginx
Google Cloud Platform
Ingress (L7)
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 and GCE implementations
No SSL yet
Status: BETA in Kubernetes v1.1
URL Map
Client
Google Cloud Platform
Secrets
Google Cloud Platform
Secrets
Problem: how to grant a pod access to a
secured something?
• don’t put secrets in the container image!
12-factor says: config comes from the
environment
• Kubernetes is the environment
Manage secrets via the Kubernetes API
Inject them as virtual volumes into Pods
• late-binding
• tmpfs - never touches disk
node
API
Pod Secret
Google Cloud Platform
ReplicationControllers
Google Cloud Platform
ReplicationControllers
A simple control loop
Runs out-of-process wrt API server
Has 1 job: ensure N copies of a pod
• if too few, start some
• if too many, kill some
• grouped by a selector
Cleanly layered on top of the core
• all access is by public APIs
Replicated pods are fungible
• No implied order or identity
ReplicationController
- name = “my-rc”
- selector = {“App”: “MyApp”}
- podTemplate = { ... }
- replicas = 4
API Server
How
many?
3
Start 1
more
OK
How
many?
4
Google Cloud Platform
• 3x the number of pods per node
• Horizontal Pod Autoscaling -- deeper integration
• Multiple scheduler support
• Make Job controller GA
• Multiple zone support (Ubernetes-lite)
• Improve API extensibility points
• A “Readability guide” document for writing Kubernetes APIs
• Allow system to detect nodes as being compliant automatically (Node
conformance test)
Sneak peek: 1.2 Roadmap
Google Cloud Platform
Kubernetes is Open
- open community
- open design
- open source
- open to ideas
http://kubernetes.io
https://github.com/kubernetes/kubernetes
slack: kubernetes
twitter: @kubernetesio

Cloud native applications

  • 1.
    Google Cloud Platform RunningCloud Native Apps on Kubernetes Daniel Smith <dbsmith@google.com> Sr. Software Engineer @lavalamp on github
  • 2.
    Google Cloud Platform Kubernetes Providescluster management: • Runs and manages containers • Inspired and informed by Google’s experiences and internal systems • Supports multiple cloud and bare-metal environments • Supports multiple container runtimes • 100% Open source, written in Go Manage applications, not machines
  • 3.
    Google Cloud Platform Everythingat Google runs in containers: • Gmail, Web Search, Maps, ... • MapReduce, batch, ... • GFS, Colossus, ... • Even Google’s Cloud Platform: our VMs run in containers! We launch over 2 billion containers per week
  • 4.
    Google Cloud Platform Butit’s all so different! • Deployment • Management, monitoring • Isolation (very complicated!) • Updates • Discovery • Scaling, replication, sets A fundamentally different way of managing applications requires different tooling and abstractions Images by Connie Zhou
  • 5.
    Google Cloud Platform UI Allyou really care about Internet Your App
  • 6.
    Google Cloud Platform 12factor III. Config • Store config in the environment VI. Processes • Execute the app as one or more stateless processes VII. Port binding • Export services via port binding VIII. Concurrency • Scale out via the process model Cloud Native Apps
  • 7.
  • 8.
    Google Cloud Platform Pods Smallgroup of containers & volumes Tightly coupled The atom of scheduling & placement Shared namespace • share IP address & localhost • share IPC, etc. Managed lifecycle • bound to a node, restart in place • can die, cannot be reborn with same ID Example: data puller & web server Consumers Content Manager File Puller Web Server Volume Pod
  • 9.
  • 10.
    Google Cloud Platform Services Agroup of pods that work together • grouped by a selector Defines access policy • “load balanced” or “headless” Gets a stable virtual IP and port • sometimes called the service portal • also a DNS name VIP is managed by Kubernetes • App developer doesn’t have to think about it Hides complexity - ideal for non-native apps Client Virtual IP
  • 11.
    Google Cloud Platform ExternalServices Services IPs are only available inside the cluster Need to receive traffic from “the outside world” Builtin: Service “type” • nodePort: expose on a port on every node • loadBalancer: provision a cloud load-balancer DiY load-balancer solutions • haproxy • nginx
  • 12.
    Google Cloud Platform Ingress(L7) 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 and GCE implementations No SSL yet Status: BETA in Kubernetes v1.1 URL Map Client
  • 13.
  • 14.
    Google Cloud Platform Secrets Problem:how to grant a pod access to a secured something? • don’t put secrets in the container image! 12-factor says: config comes from the environment • Kubernetes is the environment Manage secrets via the Kubernetes API Inject them as virtual volumes into Pods • late-binding • tmpfs - never touches disk node API Pod Secret
  • 15.
  • 16.
    Google Cloud Platform ReplicationControllers Asimple control loop Runs out-of-process wrt API server Has 1 job: ensure N copies of a pod • if too few, start some • if too many, kill some • grouped by a selector Cleanly layered on top of the core • all access is by public APIs Replicated pods are fungible • No implied order or identity ReplicationController - name = “my-rc” - selector = {“App”: “MyApp”} - podTemplate = { ... } - replicas = 4 API Server How many? 3 Start 1 more OK How many? 4
  • 17.
    Google Cloud Platform •3x the number of pods per node • Horizontal Pod Autoscaling -- deeper integration • Multiple scheduler support • Make Job controller GA • Multiple zone support (Ubernetes-lite) • Improve API extensibility points • A “Readability guide” document for writing Kubernetes APIs • Allow system to detect nodes as being compliant automatically (Node conformance test) Sneak peek: 1.2 Roadmap
  • 18.
    Google Cloud Platform Kubernetesis Open - open community - open design - open source - open to ideas http://kubernetes.io https://github.com/kubernetes/kubernetes slack: kubernetes twitter: @kubernetesio