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

Running Workloads in Kubernetes

Janet Kuo
August 04, 2017

Running Workloads in Kubernetes

An overview of built-in controllers in Kubernetes. The intended audience is Kubernetes beginners.

Kubernetes 1.7 new features are included in the slides.

#Kubernetes #K8s #containers

Janet Kuo

August 04, 2017
Tweet

More Decks by Janet Kuo

Other Decks in Technology

Transcript

  1. Janet Kuo Software Engineer Twitter: @janet_kuo github.com/janetkuo Running Workloads in

    Kubernetes
  2. 2 Google Cloud Platform https://goo.gl/dWYJq4

  3. 3 Google Cloud Platform https://goo.gl/2NLT0f

  4. Concept

  5. Google Cloud Platform 5 Kubernetes is a platform for application

    patterns
  6. Google Cloud Platform 6 Pod is a single instance of

    an application in Kubernetes
  7. Google Cloud Platform 7 Controller manages replicated pods for an

    application pattern
  8. 8 Google Cloud Platform Master node Worker node Worker node

  9. 9 Google Cloud Platform Master node Worker node Worker node

    Pod Container Container Pod Container Container
  10. 10 Google Cloud Platform Master node Worker node Worker node

    Pod Container Container Pod Container Container C controller
  11. Four General Patterns

  12. 12 Google Cloud Platform No persistent states • Web frontends

    • Web servers Keeps states • Databases • Message queues Daemon that runs as a background process • Cluster storage • Logs collection • Node monitoring DAEMON Batch processing of independent work items • Emails to send • Frames to render BATCH STATELESS STATEFUL Application Patterns
  13. Four Controllers Each for one pattern

  14. 14 Google Cloud Platform 01 Deployment For Stateless Pattern No

    persistent states Scale is easy Availability > Consistency Create multiple replicas of the same pod Pods are disposable Rolling update Update at a controlled rate Block updates on failure History and rollback
  15. 15 Google Cloud Platform kubectl Master node Worker node Worker

    node Pod Container Container Pod Container Container Service C async Demo: https://github.com/janetkuo/k8s-demos/tree/master/dep 01 Deployment For Stateless Pattern
  16. 16 Google Cloud Platform 02 StatefulSet For Stateful Pattern Store

    persistent data Need stable, unique, and sticky identity and storage Consistency > Availability Create similar pods, each has its own identity and storage Pods are not disposable Deploy, scale, terminate In order (default), or in parallel (1.7 feature) Rolling update (1.7 feature) Update one pod at a time, and block updates on failure History
  17. 17 Google Cloud Platform kubectl Master node Worker node Worker

    node Pod 0 Container Container Pod 1 Container Container Service C async Demo: https://github.com/janetkuo/k8s-demos/tree/master/stateful 02 StatefulSet For Stateful Pattern
  18. 18 Google Cloud Platform 03 DaemonSet For Daemon Pattern One

    Daemon per node Background process Daemons created and removed with nodes Node labels Control which nodes daemons should run on Rolling update (1.6 feature) Update at a controlled rate Block updates on failure History and rollback
  19. 19 Google Cloud Platform kubectl Master node Worker node Worker

    node Pod Container Container Pod Container Container Service C async Demo: https://github.com/janetkuo/k8s-demos/tree/master/ds 03 DaemonSet For Daemon Pattern
  20. 20 Google Cloud Platform 04 Jobs For Batch Pattern Run

    in Parallel How many pods can be created and running at a time Run to Completion How many pods need to complete (exit successfully) Parallel processing of independent but related work items Emails to send or frames to render
  21. 21 Google Cloud Platform kubectl Master node Worker node Worker

    node Pod Container Container Pod Container Container C async Demo: https://github.com/janetkuo/k8s-demos/tree/master/jobs 04 Jobs For Batch Pattern
  22. Recap

  23. 23 Google Cloud Platform 4 Controllers for 4 Patterns •

    Availability • Scale & recover easily • Disposable copies of the same pod • Consistency • Unique, sticky identity and storage • Deploy, scale, and terminate in order or in parallel • One pod per node by default • Daemon pods added and removed with nodes • Use node labels to control DaemonSet for daemon pattern • Run multiple pods in parallel • Run pods to completion Jobs for batch pattern Deployment for stateless pattern StatefulSet for stateful pattern
  24. Where Do I Start?

  25. 25 Google Cloud Platform Focus on using Kubernetes, not managing

    it. Google Container Engine Google Compute Engine Run containers on Google Cloud Platform, powered by Kubernetes. Minikube Use Kubernetes locally on your laptop. Get a Kubernetes Cluster Kubernetes runs anywhere! Full list of solutions: https://kubernetes.io/docs/setup/pick-right-solution/
  26. 26 Google Cloud Platform Kubernetes Package Manager Kubernetes Charts github.com/kubernetes/charts

    Charts are curated application definitions for Kubernetes Kubernetes Helm https://github.com/kubernetes/helm Helm is a tool for managing Kubernetes charts.
  27. 27 Google Cloud Platform How Do I Customize? Kubernetes is

    extensible! github.com/upmc-enterprises/elasticsearch-operator github.com/coreos/etcd-operator Write your own controllers. Use the controllers that others wrote.
  28. 28 Google Cloud Platform Kubernetes is Open github.com/kubernetes/kubernetes kubernetes.io slack.k8s.io

    / @janet @kubernetesio / @janet_kuo
  29. Questions?

  30. Appendix

  31. VM1 OS v3.14 Dependencies v1 VM2 OS v3.16 App Code

    App Code Dependencies v2 Container Container Container Dependencies v2 App Code App Code Dependencies v2 App Code Dependencies v2 Virtualized App relies on dependencies installed on the guest OS Containerized Code and dependencies packaged in modular unit Container 101