Sahdev Zala Henry Nash Martin Hickey: © 2018 IBM Corporation
Sahdev Zala Henry Nash Martin Hickey: © 2018 IBM Corporation
Sahdev Zala
[email protected]
Henry Nash
[email protected]
Martin Hickey
[email protected]
• kubectl way
• Helm way
• Helm in action
• Charts
• Repository
• Release
• Installation
• Where is Helm?
• Helm 3
• Summary
• Kubernetes vs Helm
3
Guestbook App
User
Redis backend
PHP Frontend
5
Deploying Guestbook – kubectl Way
Pain points
– CI/CD pipeline
• kubectl deployments are not easy to configure, update and rollback
– Deploying app to dev/test/production may require different configuration
» Update deployment e.g. update with a new image
• Requires to track your deployment and modify YAML files (can be error prone)
• Does not allow multiple deployments without updating metadata in manifest files
– Share your deployment configurations with your friend, team or customer?
• You need to share many files and related dependencies
• Your users are required to have knowledge of deployment configuration
6
Deploying Guestbook – Desired Way
• Templatize YAML files which allows providing configuration values at runtime and eliminate the
need of modifying YAML files for
• Scaling
• Update
• Rollback
7
Here Comes Helm
– Easy to share
8
So, What is Helm?
9
So, What Helm is NOT
10
Five Keywords
helm
– While Helm is the name of the project, the command line client is also named helm. By convention, when speaking of the project, Helm is
capitalized. When speaking of the client, helm is in lowercase.
Tiller
– Tiller is the Helm server. It interacts directly with the Kubernetes API server to install, upgrade, query, and remove Kubernetes resources. It
is installed in the Kubernetes cluster.
Chart
– It contains all of the resource definitions necessary to run an application, tool, or service inside of a Kubernetes cluster. A chart is basically a
package of pre-configured Kubernetes resources.
Release
– An instance of a chart running in a Kubernetes cluster
Repository
– Place where charts reside and can be shared with others
11
Let’s See
Helm in
Action
12
Demo – Guestbook Chart Deployment
• Check existing installation of Helm chart
• helm ls
• Add repo
• helm repo add helm101 https://ibm.github.io/helm101/
• Install
• helm install helm101/guestbook --name myguestbook --set serviceType=NodePort – follow the output instructions to see your guestbook application
13
Demo – Guestbook Upgrades and Rollback
First let’s see what we have
Upgrade
Rollback
14
Demo – Clean Up
• Remove repo
• helm repo remove helm101
15
Guestbook
Chart
https://github.com/IBM
/helm101/tree/master/
charts/guestbook
16
Let’s Learn
More About
Helm
17
Helm Architecture
18
What’s the Chart all about?
19
Chart Template Snippet
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
………………………………………….
spec:
ports:
- name: http-server
containerPort: {{ .Values.service.port }}
20
Chart Structure
• A chart is organized as a collection of files inside of a directory
• The directory name is the name of the chart e.g. guestbook.
• Inside of the directory, the expected file structure is
22
Where are the Charts?
• Charts reside in:
• Helm upstream charts repository
– https://github.com/helm/charts
23
Helm Release
• When a chart is installed, Helm creates a release to track that installation
• A single chart may be installed many times into the same cluster using different
releases
– Let’s say you need multiple, independent, instance of database on a same cluster
» You can reuse the same chart that can deploy a database by specifying different release names
• helm install --name redis1 stable/redis
• helm install --name redis2 stable/redis
• Upgrade
• helm upgrade <RELEASE> <CHART>
• This will upgrade existing deployment of specified release
• Rollback
• helm rollback <RELEASE> <REVISION>
• This will rollback a helm deployment to the specified revision number
• To see revision numbers, run helm history <RELEASE>
25
Installing Helm
• Things to consider
• There are two parts to Helm install:
– Helm Client (helm)
– Helm Server (Tiller)
26
Helm Client Install
• Install Helm Client (helm)
• Binary downloads of the Helm client can be found for the following OSes:
– OSX
– Linux
– Windows
– Helm releases: https://github.com/helm/helm/releases
27
Helm Server Install
• Install Helm Server (Tiller)
• Tiller can be installed in one of two ways:
– In the Kubernetes cluster (recommended way)
• Run locally:
– tiller
– export HELM_HOST=localhost:44134 (for helm client. Alternatively, can pass –host when running
client command)
28
Where is Helm?
• GitHub repository - https://github.com/helm/helm
• Channels on the Kubernetes Slack workspace - https://kubernetes.slack.com
• #helm-users
• #helm-dev
• #charts
29
Future
30
Helm v3
Key Changes
– Helm has an embedded Lua engine for scripting some event handlers - scripts stored in charts
– For pull-based DevOps workflow, a new Helm Controller project will be started
• This is not required for a deployment and will be optional
– Cross platform plugins in Lua that only have a runtime dependency on Helm
Helm CLI
The Helm v3 Client (helm) is a ( helm) Helm push/fetch Chart
Library
command-line client façade that
Repository
32
Helm v3 Time Frame
• Provisional dates:
• Alpha version: 2018 EOY
• Release: Mid 2019
• More detail on v3 functionality
• https://github.com/helm/community/blob/master/helm-v3/000-helm-v3.md
• Milestones can be tracked
• https://github.com/kubernetes/helm/milestones
• A second use of the (new) Helm library is proposed as a “Helm Controller” that could be
installed into the cluster to enable pull operations. Details of this are, as yet, not defined.
However, this would NOT act on behalf of the v3 Helm client, rather have its own TBD interface.
33
Summary
34
Deployment - Kubernetes vs Helm
Deployment
kubectl • You need to know the manifest YAML file(s) you are deploying
• $ kubectl create –f *.yaml
• Can not deploy same workload without modifying YAML files.
• Requires valid manifest upfront because it lacks templating mechanism like
helm. With helm, a valid manifest can be produced at runtime combining YAML
templates and values.yaml file.
helm • No need to know the which YAML files to use. Install with chart name, helm
install charts/guestbook --name guestbook1
• Same chart can be deployed multiple times by simply providing different
release names at runtime.
• Templating provides robustness of generating manifest files at runtime.
35
Upgrade/Rollback - Kubernetes vs Helm
Upgrade/Rollback with new values
kubectl • Multiple ways but each can add complexities
• Modify the values in the YAML files OR
• Create ConfigMap OR
• Set environmental variables
• Other users can not get your environment.
• User need to know the configuration for rollback.
helm • No need to touch Kuberntes manifest files. Change the values in values.yaml
or provide on command line.
• For example, $ helm install charts/guestbook --name guestbook1 --set
serviceType=NodePort
• Configuration files are saved by Helm release which makes rollback easy.
36
Share Configuration Files - Kubernetes vs Helm
Share
kubectl
• Not as easy as Helm chart unless for a basic deployments with a
single YAML manifest file.
• User need to download multiple files/dependencies.
helm
• Easy to share by uploading charts to remote repository
• For example, several ready to use charts are available at:
• Helm official chart repo: https://github.com/helm/charts
• IBM chart repo: https://github.com/IBM/charts
37
Thank you
twitter.com/sp_zala
twitter.com/henrynash
twitter.com/mhickeybot
github.com/spzala
github.com/henrynash
github.com/hickeyma
developer.ibm.com
38
Backup
39
Demo – Chart Deployment
– helm ls
Add repo
Install
– helm install helm101/guestbook --name myguestbook --set serviceType=NodePort – follow the output instructions to see your guestbook application
– helm ls
40
Demo – Upgrades and
Rollback
First let’s see what we have
Upgrade
Rollback
41
Demo – Clean Up
Remove repo
– helm repo remove helm101
Remove chart completely
42
Overview of Containers
43
Why Helm?
– You can:
• Use existing charts created by others
• Create your own charts and share with others
• Easily manage your Kubernetes manifest files, configuration values and related
resources as a package
• Release charts and manage releases
Configuring deployment with user values
Active development with a strong community behind it
• Compute
• Volumes
• Networks
• And many many many more...
• Declarative model
• Provide the "desired state" and Kubernetes will make it happen
• What's in a name?
• Kubernetes (K8s/Kube): "Helmsman" in ancient Greek
45
Kubernetes vs Helm
deployments
Deployment Upgrade/Rollback with new values Share
• You need to know the manifest YAML • Multiple ways but each can add • Not as easy as Helm chart unless for
file(s) you are deploying complexities a basic deployments with a single
• $ kubectl create –f *.yaml • Modify the values in the YAML YAML manifest file.
• Can not deploy same workload files OR • User need to download multiple files.
without modifying YAML files. • Create ConfigMap OR
kubectl • Requires valid manifest upfront • Set environmental variables
because it lacks templating • Other users can not get your
mechanism like helm. With helm, a environment.
valid manifest can be produced at • User need to know the configuration
runtime combining YAML templates for rollback.
and values.yaml file.
• No need to know the which YAML • No need to touch Kuberntes manifest • Easy to share by uploading charts to
files to use. Install with chart name, files. Change the values in remote repository
helm install charts/guestbook -- values.yaml or provide on command • For example, several ready to use
helm name guestbook1 line. charts are available at the
• Same chart can be deployed multiple • For example, $ helm install https://github.com/IBM/charts
times by simply providing different charts/guestbook --name
release names at runtime. guestbook1 --set
• Templating provides robustness of serviceType=NodePort
generating manifest files at runtime. • Configuration files are saved by Helm
release which makes rollback easy.
46
Helm Security Considerations
47
Helm Chart Installation Flow
49
50