Slide 1

Slide 1 text

Managing Kubernetes Deployments with Helm Vincent De Smet

Slide 2

Slide 2 text

Overview - Kubernetes - Concepts - Challenges - Helm - Introduction - Templating

Slide 3

Slide 3 text

Kubernetes Concepts & Challenges

Slide 4

Slide 4 text

Linux Host CONTAINERS Container foo rails server -b 0.0.0.0 usr/src/app/ ├── Gemfile ├── Gemfile.lock ├── Rakefile ├── app │ ├── api │ └── ... └── bins / libs ...

Slide 5

Slide 5 text

BUILD, SHIP, RUN

Slide 6

Slide 6 text

PODS & VOLUMES Container Foo Container Bar Namespaces: - Net - IPC - … volumes

Slide 7

Slide 7 text

PODS & VOLUMES volumes

Slide 8

Slide 8 text

LABELS app : my-app role : master track: stable

Slide 9

Slide 9 text

LABELS app : my-app role : master track: stable app : my-app role : worker track: stable app : my-app role : worker track: canary app : my-app role : master track: canary

Slide 10

Slide 10 text

SELECTORS app : my-app app : my-app role : master track: stable app : my-app role : worker track: stable app : my-app role : worker track: canary app : my-app role : master track: canary

Slide 11

Slide 11 text

SELECTORS app : my-app role : worker app : my-app role : master track: stable app : my-app role : worker track: stable app : my-app role : worker track: canary app : my-app role : master track: canary

Slide 12

Slide 12 text

SELECTORS app : my-app track: canary app : my-app role : master track: stable app : my-app role : worker track: stable app : my-app role : worker track: canary app : my-app role : master track: canary

Slide 13

Slide 13 text

CONTROL LOOPS Desired state Actual state pods: - foo - bar pods: - foo

Slide 14

Slide 14 text

CONTROL LOOPS Desired state Actual state pods: - foo - bar pods: - foo create “bar” Create

Slide 15

Slide 15 text

CONTROL LOOPS Desired state Actual state pods: - foo - bar pods: - foo - bar

Slide 16

Slide 16 text

REPLICA SETS + Replica Set: - replicas: 1 - selector: - app: my-app - version: 1.0 - Desired State: - Pod Specification - Replica Count - Label Selector

Slide 17

Slide 17 text

REPLICA SETS + Replica Set: - replicas: 2 - selector: - app: my-app - version: 1.0

Slide 18

Slide 18 text

REPLICA SETS + Replica Set: - replicas: 4 - selector: - app: my-app - version: 1.0

Slide 19

Slide 19 text

SERVICES Service: - nodePort: 30128 - selector: - app: my-app - version: 1.0 - de-couple discovery from application - Define how to access pods - Act as a proxy (Virtual IP - stable for DNS) Think of: - Dynamic Routing Table

Slide 20

Slide 20 text

CANARIES + Replica Set: - replicas: 2 - selector: - app: my-app - version: 1.0 Service: - nodePort: 30128 - selector: - app: my-app + Replica Set: - replicas: 1 - selector: - app: my-app - version: canary Think of: - Partially live the new version

Slide 21

Slide 21 text

DEPLOYMENTS Service: - nodePort: 30128 - selector: - app: my-app + Replica Set: - replicas: 2 - selector: - app: my-app - version: 1.0 + - Manage updates with Deployment resources

Slide 22

Slide 22 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + Replica Set: - replicas: 4 - selector: - app: my-app - version: 1.0 + Deployment: - strategy: - rollingUpdate

Slide 23

Slide 23 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + + Replica Set: - replicas: 1 - selector: - app: my-app - version: 2.0 Replica Set: - replicas: 4 - selector: - app: my-app - version: 1.0 + Deployment: - strategy: - rollingUpdate

Slide 24

Slide 24 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + + Replica Set: - replicas: 1 - selector: - app: my-app - version: 2.0 Replica Set: - replicas: 3 - selector: - app: my-app - version: 1.0 + Deployment: - strategy: - rollingUpdate

Slide 25

Slide 25 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + + Replica Set: - replicas: 2 - selector: - app: my-app - version: 2.0 Replica Set: - replicas: 3 - selector: - app: my-app - version: 1.0 + Deployment: - strategy: - rollingUpdate

Slide 26

Slide 26 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + + Replica Set: - replicas: 2 - selector: - app: my-app - version: 2.0 Replica Set: - replicas: 2 - selector: - app: my-app - version: 1.0 + Deployment: - strategy: - rollingUpdate

Slide 27

Slide 27 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + + Replica Set: - replicas: 3 - selector: - app: my-app - version: 2.0 Replica Set: - replicas: 2 - selector: - app: my-app - version: 1.0 + Deployment: - strategy: - rollingUpdate

Slide 28

Slide 28 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + + Replica Set: - replicas: 3 - selector: - app: my-app - version: 2.0 Replica Set: - replicas: 1 - selector: - app: my-app - version: 1.0 + Deployment: - strategy: - rollingUpdate

Slide 29

Slide 29 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + Replica Set: - replicas: 4 - selector: - app: my-app - version: 2.0 Replica Set: - replicas: 1 - selector: - app: my-app - version: 1.0 + + Deployment: - strategy: - rollingUpdate

Slide 30

Slide 30 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + Replica Set: - replicas: 4 - selector: - app: my-app - Version: 2.0 Replica Set: - replicas: 0 - selector: - app: my-app - version: 1.0 + + Deployment: - strategy: - rollingUpdate

Slide 31

Slide 31 text

UPDATES Service: - nodePort: 30128 - selector: - app: my-app + Replica Set: - replicas: 4 - selector: - app: my-app - Version: 2.0 + Deployment: - strategy: - rollingUpdate

Slide 32

Slide 32 text

CONFIGMAPS Service: - nodePort: 30128 - selector: - app: my-app + + Deployment: - strategy: - rollingUpdate ConfigMap: - sample.yaml: | env: production cache: true max_threads: 8

Slide 33

Slide 33 text

SECRETS Service: - nodePort: 30128 - selector: - app: my-app + + Deployment: - strategy: - rollingUpdate Secret: - sample.yaml: | key: *** db_user: *** db_pw: ***

Slide 34

Slide 34 text

Recap - Multiple resource types - Deployments - Services - ConfigMaps - Secrets - … - Serializable Manifests (store as yaml) Managing these bundles is a challenge in the long run!

Slide 35

Slide 35 text

Challenges 1. Collaboration a. Sharing Manifest files, trust? b. Iterating c. Best Practices 2. Managing Releases a. Define package b. Tweaking ~ Multiple copies & variations c. Migrating

Slide 36

Slide 36 text

Helm Introduction & Templating

Slide 37

Slide 37 text

Helm: Package Manager - Collaboration with Google, Bitnami, Deis and others - Deis/Helm -> Kubernetes/Helm - Architecture: - Client: Helm - Server: Tiller - This talk: - Focused on writing charts

Slide 38

Slide 38 text

Helm core values - Aim for the Apt/Yum/Homebrew UX - Ensure collaboration - Reproducible releases - Shareable Packages

Slide 39

Slide 39 text

Chart, Repositories, Releases - Chart: “Package”, “Bundle” - Repository: Package Repository Evolving towards a registry (CoreOS) - Release: Installed Chart (same chart can be installed multiple times)

Slide 40

Slide 40 text

Basic Architecture Client - Server

Slide 41

Slide 41 text

Usage

Slide 42

Slide 42 text

Writing Charts - Templating and Release Management - More templating and User notes - Debugging and Troubleshooting features

Slide 43

Slide 43 text

Templating & Release Management workshop available

Slide 44

Slide 44 text

Review using helm - Install charts (creates a release) - helm install - List releases - helm ls - - Bootstrap charts - helm create

Slide 45

Slide 45 text

More features - Upgrade Releases - helm upgrade - Search Charts - helm search - KubeApps.com (Monocular - https://github.com/helm/monocular) - Manage Chart dependencies - requirements.yaml - helm dep up - Helm Plugins - Keybase: helm keybase sign/verify - GitHub: helm github push

Slide 46

Slide 46 text

More info Kubecon talk

Slide 47

Slide 47 text

Thank you!

Slide 48

Slide 48 text

Future? - Advanced orchestration (AppController)

Slide 49

Slide 49 text

Shipping, Deploying & Service Discovery