This Hands-On Lab is intended to provide practice with installing and configuring Helm in a Kubernetes environment.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Install Helm and Tiller in the Existing Cluster
Download the helm binary release:
[user@host]$ curl https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz > ./helm.tar.gz
Extract the archive:
[user@host]$ tar -xvf ./helm.tar.gz
Navigate to the
linux-amd64
directory:[user@host]$ cd linux-amd64
Move the
helm
andtiller
executable files to the/usr/local/bin
directory:[user@host]$ sudo mv ./helm /usr/local/bin [user@host]$ sudo mv ./tiller /usr/local/bin
Run the
helm version
command to ensure that the helm command is available:[user@host]$ helm version
Install tiller:
[user@host]$ helm init --stable-repo-url https://charts.helm.sh/stable
Run the version command again to ensure that Tiller is available:
[user@host]$ helm version
- Deploy, Troubleshoot, and Verify Deployment of the NGINX Chart
Ensure that you are in the
cloud_user
home directory. This directory contains thenginx
chart at/home/cloud_user/nginx
:[cloud_user@host]$ cd ~
This command should return a directory listing containing
Chart.yaml
:[cloud_user@host]$ls ./nginx
Install the nginx chart:
[cloud_user@host]$ helm install ./nginx
This command should error with a "name" error, due to the
tiller
service account missing.
Add thetiller
service account:[cloud_user@host]$ kubectl create serviceaccount --namespace kube-system tiller [cloud_user@host]$ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller [cloud_user]$ kubectl patch deploy --namespace kube-system tiller-deploy -p'{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
Wait for the tiller pod to restart with the update, and then install the
nginx
example chart:[cloud_user@host]$ helm install ./nginx
Once the release has completed and you see the release output, locate the cluster IP for the service that has been created. Then confirm that the
nginx
pod has been deployed correctly.[cloud_user@host]$ curl "service cluster ip":8888
This should return an html message.
Clean up the test deployment, get the release name from Helm, and then delete the release:
[cloud_user@host]$ helm ls --short [cloud_user@host]$ helm delete "return from previous command"
Confirm that the release has been removed. The following commands should return nothing:
[cloud_user@host]$ helm ls [cloud_user@host]$ kubectl get pods