$30 off During Our Annual Pro Sale. View Details »

Kubernetes: Changing the Way we Think and Talk about Computing

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. Changing the way we Think and Talk about Computing
    Kubernetes

    View Slide

  2. @tekgrrl #kubernetes #containercamp
    Mandy Waite
    Developer Advocate
    +MandyWaite
    @tekgrrl

    View Slide

  3. Image by Connie
    Zhou

    View Slide

  4. @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

    View Slide

  5. @tekgrrl #kubernetes #containercamp
    Developer View

    View Slide

  6. @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

    View Slide

  7. 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!

    View Slide

  8. #dockerjp #kubernetes @tekgrrl
    Developer View

    View Slide

  9. #dockerjp #kubernetes @tekgrrl
    task-eviction rates and
    causes
    Failures

    View Slide

  10. #dockerjp #kubernetes @tekgrrl
    Resource reclamation
    time
    limit: amount of resource
    requested
    usage: actual resource
    consumption
    Efficiency
    reservation: estimate of
    future usage
    potentially reusable
    resources

    View Slide

  11. #dockerjp #kubernetes @tekgrrl
    one
    machine
    Efficiency
    Advanced bin-
    packing
    algorithms
    Experimental
    placement of
    production VM
    workload, July 2014

    View Slide

  12. #dockerjp #kubernetes @tekgrrl
    Efficiency
    Used CPU
    Used CPU (in cores)
    Used Memory
    Used Memory
    Available
    Resources
    Stranded
    Resources

    View Slide

  13. #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

    View Slide

  14. #dockerjp #kubernetes @tekgrrl
    Computing Tetris

    View Slide

  15. #dockerjp #kubernetes @tekgrrl
    Resource Stranding
    5.5GB RAM
    Inaccessible
    CPU Fully
    Utilized

    View Slide

  16. #dockerjp #kubernetes @tekgrrl
    Bin Packing
    1 CPU
    Available
    5.5GB RAM
    Available

    View Slide

  17. #dockerjp #kubernetes @tekgrrl
    Bin Packing

    View Slide

  18. #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)

    View Slide

  19. Kubernetes

    View Slide

  20. @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

    View Slide

  21. @tekgrrl #kubernetes #containercamp
    web browsers
    y
    Kubelet Kubelet Kubelet Kubelet
    Kubernetes Master
    Replication
    Controller
    Scheduler
    API Server
    Kube-UI
    Container
    Registry
    kubectl
    Proxy

    web browsers
    Developer View (Kubernetes)

    View Slide

  22. @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

    View Slide

  23. @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

    View Slide

  24. @tekgrrl #kubernetes #containercamp
    php
    MySQL
    php
    php
    python
    memcached
    d
    Mapping to Kubernetes
    Client

    View Slide

  25. @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

    View Slide

  26. Demo - Visualization

    View Slide

  27. @tekgrrl #kubernetes #containercamp
    A Quick Guide to Nodes
    Node2
    Kubelet Proxy
    disk = ssd
    type = FE
    Resources
    Labels
    Disks

    View Slide

  28. @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

    View Slide

  29. @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

    View Slide

  30. @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

    View Slide

  31. @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

    View Slide

  32. @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

    View Slide

  33. @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

    View Slide

  34. @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

    View Slide

  35. @tekgrrl #kubernetes #containercamp
    Tweet questions to:
    @tekgrrl
    Questions

    View Slide

  36. @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

    View Slide