Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kubernetes: Changing the Way we Think and Talk ...

Kubernetes: Changing the Way we Think and Talk about Computing

We're looking at a major revolution in Cloud Computing, the likes of Docker, CoreOS, Mesos, Kubernetes and many other technologies are not only changing the way we harness our computing power but are also changing the way that we talk about it. In this session we'll look at the new metaphors of computing through the lens of Kubernetes. We'll make use of the Kubernetes API and visualization libraries to get to a better understanding of the underlying mechanics of Kubernetes, we'll build clusters, schedule pods, group containers and expose services, and we'll visually demonstrate how they are all wired together.

Presented at Container Camp London (Sep 2015)

GoogleCloudPlatform

September 11, 2015
Tweet

More Decks by GoogleCloudPlatform

Other Decks in Technology

Transcript

  1. @tekgrrl #kubernetes #containercamp 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
  2. @tekgrrl #kubernetes #containercamp web browsers BorgMaster link shard UI shard

    BorgMaster link shard UI shard BorgMaster link shard UI shard BorgMaster link shard UI shard Scheduler borgcfg web browsers scheduler Borglet Borglet Borglet Borglet Config file BorgMaster link shard UI shard persistent store (Paxos) Binary What just happened? Cell Storage Developer View
  3. 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!
  4. #dockerjp #kubernetes @tekgrrl Resource reclamation time limit: amount of resource

    requested usage: actual resource consumption Efficiency reservation: estimate of future usage potentially reusable resources
  5. #dockerjp #kubernetes @tekgrrl one machine Efficiency Advanced bin- packing algorithms

    Experimental placement of production VM workload, July 2014
  6. #dockerjp #kubernetes @tekgrrl Efficiency Used CPU Used CPU (in cores)

    Used Memory Used Memory Available Resources Stranded Resources
  7. #dockerjp #kubernetes @tekgrrl The Machine is just a Resource Boundary

    Machines (Virtual and Bare Metal) have shapes: 2GB/Core, 4GB/Core, 8GB/Core, etc Workloads have shapes too: 1GB/Core, 3.5GB/Core, etc Machine Shapes Workload Shapes
  8. #dockerjp #kubernetes @tekgrrl Images by Connie Zhou Observations: • Efficiency

    comes from ◦ Scavenging unused allocations ◦ Effective Prioritization ◦ Sharing resources ◦ Overcommit ◦ Smarter Scheduling • The Datacenter is one big System ◦ The machine is just a resource boundary • Containers make everyone more productive http://kubernetes.io http://goo.gl/1C4nuo (Borg paper)
  9. @tekgrrl #kubernetes #containercamp Greek for “Helmsman”; also the root of

    the word “Governor” • Orchestrator for Docker containers • Supports multi-cloud environments • Inspired and informed by Google’s experiences and internal systems • Open source, written in Go Manage applications, not machines Kubernetes
  10. @tekgrrl #kubernetes #containercamp web browsers y Kubelet Kubelet Kubelet Kubelet

    Kubernetes Master Replication Controller Scheduler API Server Kube-UI Container Registry kubectl Proxy <Your App> web browsers Developer View (Kubernetes)
  11. @tekgrrl #kubernetes #containercamp Service Label selectors: version = 1.0 type

    = Frontend Service Label selector: type = FE Replication Controller Pod Pod frontend Pod version= v1 version = v1 Replication Controller version = v1 #pods = 2 show: version = v2 type = FE type = FE VIP Canary Example Replication Controller Replication Controller version = v2 #pods = 1 show: version = v2 Pod frontend Pod version = v2 type = FE
  12. @tekgrrl #kubernetes #containercamp Developer View (Replication Controller) spec: containers: -

    name: php-guestbook image: php-guestbook:containercamp resources: limits: memory: "128Mi" cpu: "500m" ports: - containerPort: 80 protocol: TCP replicas: 1 10000
  13. @tekgrrl #kubernetes #containercamp 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 Pod $ kubectl proxy --www=k8s-visualizer/ Visualizing Kubernetes Master APIs Scheduling REST (pods, services, controllers) AuthN Scheduler Replication Controller Container
  14. @tekgrrl #kubernetes #containercamp A Quick Guide to Nodes Node2 Kubelet

    Proxy disk = ssd type = FE Resources Labels Disks
  15. @tekgrrl #kubernetes #containercamp Scheduling Capabilities Step 1 - Filtering Node

    Resources I need 3.5GB RAM and 2 Cores Node Resources Node Resources Node Resources podFitsResources
  16. @tekgrrl #kubernetes #containercamp Scheduling Capabilities Step 1 - Filtering Node1

    Kubelet Proxy Node2 Kubelet Proxy Node3 Kubelet Proxy Demo-mysql-disk I need demo- mysql-disk NoDiskConflict
  17. @tekgrrl #kubernetes #containercamp PodFitsHost: Filter by NodeName PodSelectorMatches: Filter by

    Node Label (key and value) CheckNodeLabelPresence: Filter by Node Label Scheduling Capabilities Step 1 - Filtering
  18. @tekgrrl #kubernetes #containercamp LeastRequestedPriority Rank by how much free space

    will be left on the node after the node is deployed [Default] CalculateNodeLabelPriority Prefer nodes with the specified label BalancedResourceAllocation CPU and Memory is balanced after the Pod is deployed [Default] CalculateSpreadPriority minimise number of Pods from the same service on the same node CalculateAntiAffinityPriority minimise number of Pods from the same service on nodes with the same value for a particular label Scheduling Capabilities Step 2 - Ranking
  19. @tekgrrl #kubernetes #containercamp Kubernetes 1.0 as of mid July •

    Formerly announced at OSCON in July Open sourced in June, 2014 • won the BlackDuck “rookie of the year” award Google launched Google Container Engine (GKE) • hosted Kubernetes • https://cloud.google.com/container-engine/ Roadmap: • https://github.com/GoogleCloudPlatform/kubernetes/milestones Kubernetes Status
  20. @tekgrrl #kubernetes #containercamp Google Container Engine (GA) Managed Kubernetes (Kubernetes

    v1) Manages Kubernetes master uptime Manages Updates Cluster Resize via Managed Instance Groups Centralised Logging Google Cloud VPN support
  21. @tekgrrl #kubernetes #containercamp Kubernetes is Open Source We want your

    help! http://kubernetes.io https://github.com/GoogleCloudPlatform/kubernetes irc.freenode.net #google-containers @kubernetesio
  22. @tekgrrl #kubernetes #containercamp Example of Resource based scheduling Node1 (1

    CPU) Kubelet Proxy Pod (0.6 CPU) Container Container Node2 (1 CPU) Kubelet Proxy Pod (0.6 CPU) Container Container Node3 (1 CPU) Kubelet Proxy Pod (0.6 CPU) Container Container