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

A Developers Guide to Containers and Google Cloud Platform

A Developers Guide to Containers and Google Cloud Platform

Talk presented at GDG Silicon Valley event on 10/1/2014

GoogleCloudPlatform

October 03, 2014
Tweet

More Decks by GoogleCloudPlatform

Other Decks in Technology

Transcript

  1. A Developers Guide to Containers and
    Google Cloud Platform
    GDG Silicon Valley
    Mandy Waite
    @tekgrrl
    google.com/+MandyWaite

    View Slide

  2. • [TBD]
    • More than a Sandbox, Less than a VM
    • Lightweight Linux environment
    • Hermetically sealed, deployable system
    • Introspectable, runnable artifact
    • Recently popularized by Docker
    What is a container?

    View Slide

  3. My Life with Containers I
    • Solaris Zones, circa 2005
    • Shared Hardware Resources
    • Resource, Fault and Security Isolation
    • Branded Zones
    • Now owned by a Database Company
    Solaris Zones

    View Slide

  4. Everything at Google runs in a container
    Internal usage:
    • Resource isolation and predictability
    • Quality of Services
    • batch vs. latency sensitive serving
    • Overcommitment (not for GCE)
    • Resource Accounting
    We start over 2 billion containers per week
    My Life with Containers II

    View Slide

  5. Static application
    environment = reliable
    deployments
    No stress deployment and update
    Why do developers care?
    Repeatable, runnable artifact
    = portability
    Develop here, run there
    Pick 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
    Why should developers Care?

    View Slide

  6. Managed Base OS
    Node Container Manager
    Scheduled Containers
    Cluster Scheduler
    Google Internal cluster management stack

    View Slide

  7. Containers and
    Google Cloud Platform

    View Slide

  8. Managed Base OS
    Node Container Manager
    Scheduled Containers
    Cluster Scheduler
    Node container management on the Google Cloud
    Container Optimized VM Image
    Container health monitoring and restart
    Declarative Container Manifest

    View Slide

  9. 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 container-vm-v20140929
    --image-project google-containers
    command line
    containers.yaml
    VM
    www
    8080 80

    View Slide

  10. 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 sharding
    containers.yaml
    www dataLoader
    Disk
    Volume

    View Slide

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

    View Slide

  12. Container VMs in Google Compute Engine
    Cloud VMs optimized for Containers
    Easy way to use Containers on the Google Cloud Platform:
    • Image preinstalled with: Docker, Node Container Manager
    • Loads Container Manifest at VM start time
    • [Soon] Integrate with UI, logging
    • [Soon] Basic building block for dynamic systems
    Also used by Managed VMs driven by Google App Engine

    View Slide

  13. Next Steps
    Launch a container VM:
    https://cloud.google.com/compute/docs/containers
    Send us comments/ideas:
    Discussion group: groups.google.com/forum/#!
    forum/google-containers
    IRC:
    #google-containers on irc.freenode.net
    Stack Overflow:
    Use "google-compute-engine" and "docker" tags

    View Slide

  14. Containers and PaaS

    View Slide

  15. App Engine
    Preview
    Managed VMs

    View Slide

  16. Dockerfile
    app.yaml
    All you need
    Your app
    Cloud SDK
    gcloud app run
    or
    gcloud app deploy
    Docker registry
    VM*
    container
    dockerd
    *A VM running Docker…

    View Slide

  17. app.yaml
    module: solver
    version: dockerizing
    runtime: python27
    api_version: 1
    threadsafe: on
    vm: true
    handlers:
    - url: .*
    script: main_solver.APP
    vm_settings:
    machine_type: n1-standard-1
    apt_get_install: python-opencv
    manual_scaling:
    instances: 2

    View Slide

  18. docker build
    using
    google/docker-registry
    container
    Google Compute Engine
    instance
    your laptop
    docker run
    gcloud deploy start
    update
    using
    google/docker-registry
    container
    private
    Google Cloud
    Storage
    bucket
    Google App
    Engine
    Your awesome
    docker image
    Your awesome
    docker image
    docker container
    docker push
    docker pull
    Behind the Scenes

    View Slide

  19. Storage: Cloud Datastore, Cloud SQL, Cloud Storage
    Memcache
    Task Queue
    Cloud Endpoints
    Find more! https://cloud.google.com/products/app-engine/
    App Engine APIs

    View Slide

  20. Dockerfile
    FROM google/appengine-python27
    app.yaml
    runtime:

    View Slide

  21. App Engine for Docker
    Simple to manage
    Private Registry Bucket
    APIs and SDK
    Load Balancing
    Autoscaling
    Docker for App Engine
    Use any library
    Run any code
    Transparency
    New Runtimes, build your own!
    +

    View Slide

  22. https://cloud.google.com/appengine/docs/managed-vms/

    View Slide

  23. Kubernetes

    View Slide

  24. Kubernetes
    the open source cluster manager from Google
    github.com/GoogleCloudPlatform/kubernetes
    Runs on
    ● your dev machine
    ● your own hardware
    ● cloud
    Microsoft, IBM, Red Hat, Docker, Mesosphere,
    SaltStack, CoreOS and VMware
    have joined the Kubernetes project

    View Slide

  25. Managed Base OS
    kubelet
    Scheduled Containers
    Managed Base OS
    kubelet + Docker
    Containers
    Kubernetes Master
    etcd
    Kubernetes Container Stack

    View Slide

  26. Pods
    Pod
    Container Container
    Container Container
    • Tightly coupled group of containers
    • Unit of scheduling, deployment and
    replication
    • Shared storage volumes
    • Shared Network and Port namespace

    View Slide

  27. Machine
    Machine
    Replication Controller
    • “Pod Factory”
    • Creates and manages a set of pods
    • Ensures that required number of
    Pods are running
    • Creates and kills Pods as required
    ReplicationController
    Template
    Pod
    Container Container
    Container Container
    Pod
    Container Container
    Container Container
    Pod
    Container Container
    Container Container
    Pod
    Container Container
    Container Container

    View Slide

  28. Demo

    View Slide

  29. View Slide

  30. https://github.com/GoogleCloudPlatform/kubernetes
    http://googlewebcomponents.github.io/

    View Slide

  31. End

    View Slide