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

Kubernetes - Changing the way we build platforms

Mark Wolfe
September 22, 2015

Kubernetes - Changing the way we build platforms

Presented at docker meetup in Melbourne 23/09/2015

Mark Wolfe

September 22, 2015
Tweet

More Decks by Mark Wolfe

Other Decks in Technology

Transcript

  1. Kubernetes
    Changing the way we build platforms

    View Slide

  2. Who is this guy?
    @wolfeidau on twitter
    github.com/wolfeidau
    www.wolfe.id.au
    DevOps @ http://www.versent.com.au/

    View Slide

  3. Greek for “Helmsman”; also the root of the word
    “Governor”

    View Slide

  4. Kubernetes?
    • Inspired by an internal project at Google, called Borg
    • Contributors from Google, Mesos and more
    • 1.0 release a month or so ago

    View Slide

  5. Containers
    • Unix processes not lightweight Virtual Machines
    • Application + Dependencies = image
    • Runtime environment (cgroups, namespaces, environment
    variables)

    View Slide

  6. • Build applications in a dedicated build container or CI
    • Ship build artifacts, not build environments
    • Rails app container with build tools ~900MB
    • Rails app container without build tools ~300MB
    • Go service without build tools ~15MB
    • Cattle not Pets!
    Containers

    View Slide

  7. • Container management, scheduling, and service
    discovery.
    • API driven application management
    • Agents monitor endpoints for state changes (real-time)
    • Controllers enforce desired state
    • Resources (nodes, applications, services)
    Kubernetes

    View Slide

  8. Kubernetes
    • High level concepts
    • node
    • pod
    • scheduler
    • replication
    • service

    View Slide

  9. Node
    • Runs containers and proxies service requests.
    • docker
    • kubelet
    • proxy

    View Slide

  10. Pod
    • Represents a logical
    application.
    • One or more containers
    • Shared namespaces

    View Slide

  11. Scheduler
    • Schedules pods to run on nodes.
    • Global scheduler for long running jobs
    • Best fit chosen based on pod requirements
    • Pluggable

    View Slide

  12. Replication Controller
    • Manages a replicated set of pods.
    • Creates pods from a template
    • Ensures desired number of pods are running
    • Online resizing

    View Slide

  13. Replication Controller
    • Manages a replicated set of pods.
    • Creates pods from a template
    • Ensures desired number of pods are running
    • Online resizing

    View Slide

  14. Service
    • Service discovery for pods.
    • Proxy runs on each node
    • Virtual IP per service (avoid port collisions)
    • Basic round-robin algorithm
    • Dynamic backends based on label queries

    View Slide

  15. Example Pod
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    db: rethinkdb
    role: admin
    name: rethinkdb-admin
    spec:
    containers:
    - image: gcr.io/google_containers/rethinkdb:1.16.0_1
    name: rethinkdb
    env:
    - name: POD_NAMESPACE
    valueFrom:
    fieldRef:
    fieldPath: metadata.namespace
    ports:
    - containerPort: 8080
    name: admin-port
    volumeMounts:
    - mountPath: /data/rethinkdb_data
    name: rethinkdb-storage
    volumes:
    - name: rethinkdb-storage
    emptyDir: {}

    View Slide

  16. Example Service
    apiVersion: v1
    kind: Service
    metadata:
    labels:
    db: rethinkdb
    name: rethinkdb-admin
    spec:
    ports:
    - port: 8080
    targetPort: 8080
    type: LoadBalancer
    selector:
    db: rethinkdb
    role: admin

    View Slide

  17. Deployment
    • Continuous Integration / Deployment
    • Jenkins
    • Buildkite
    • Bamboo

    View Slide

  18. Transparency
    • Logging
    • ELK (Elastic Search, Logstash, Kibana)
    • Metrics
    • InfluxDB and Grafana
    • Tracing
    • Twitter Zipkin

    View Slide

  19. Resilience
    • Continuous Failure Testing
    • Chaos Monkey
    • Load Testing
    • Gattling
    • boom

    View Slide

  20. Cloud Providers
    • Kubernetes Supports
    • Google Cloud Compute and Container
    • AWS, being used by Samsung and Others
    • Openstack
    • Azure

    View Slide

  21. Questions?

    View Slide

  22. Links
    • Kubernetes Site
    • AWS Setup
    • CoreOS Kubernetes Vagrant
    • Kubernetes Rails Deployment
    • http://fabric8.io/

    View Slide