In this hands-on lab we will be working with release versions of charts in Helm.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Update the Page Index in `nginx/values.yaml`, Set the Service to `NodePort` with an External Port of `30080`, and Increment the Version Number in `nginx/Chart.yaml`
Locate the
nginx
chart that is in the home directory:[cloud_user@host]$ cd ~ [cloud_user@host]$ ls -l
Modify the index contents found in the
values.yaml
file (with whatever editor you like — we’re using Vim here with vim ./values.yaml:index: >- ##insert your html here##
Set the service to
NodePort
and the HTTP port to30080
. The entry should match this:service: annotations: {} clusterIP: "" externalIPs: [] loadBalancerIP: "" loadBalancerSourceRanges: [] type: NodePort port: 8888 nodePort: "30080"
Set a version number in
Charts.yaml
. Edit it (with something likevim ./Chart.yaml
) and update the value forversion
.- Initialize and Patch Helm
Initilize helm using the following command.
helm init
Once helm is initilized patch it into the kube sytem using the following command.
kubectl patch deploy --namespace kube-system tiller-deploy -p'{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
- Release the Chart and Confirm the Version Number of the Released Chart
Release the chart:
[cloud_user@host]$ cd ~ [cloud_user@host]$ helm install nginx
Once that command has completed, run two commands. This returns the release name:
[cloud_user@host]$ helm ls --short
Look at the chart name for the version on this one.
[cloud_user@host]$ helm history <release name>
Obtain the IP address of one of the cluster nodes other than the master and navigate to the IP:Port in a web browser http://(node_IP)"30080"
Confirm that the index page is correct.
- Update the Index Data in the ./nginx/values.yaml File and Increment the Version Number in Charts. Upgrade the Release and Verify the New Version
Update the contents of the index as done previously
Increment the version number of the Chart.yaml file as done previously
Upgrade the release.
helm init
helm ls –short <– this returns the release name
helm upgrade (release name) ~/nginxVerify the new verison of the release by checking the chart name in the helm history
helm history (release name)
Load the index page and confirm the content is correct.
- Rollback the Release to the Previous Version and Confirm that the Correct Version is Now Deployed
Get the available revisions for the helm release
helm ls --short <- this returns the release name helm history (release name)
locate the revision number that has the chart version that contains the first version you created.
helm rollback (release name) (revision number) helm history (release name) <-- verify the correct version is listed as "deployed"
Allow the pods volumes to update and check the web page content, it should be the first change you made.