Lab Title:
Using a Pre-Made Helm Chart: Customization, Upgrade, Rollback, and Cleanup
Objective:
Learn how to deploy a ready-made Helm chart, modify its configuration, upgrade the release, roll back to a previous version, and then uninstall the release—all using Helm v3.
Install Helm
Linux/MacOS
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
MacOS ( Homebrew )
brew install helm
Windows
choco install kubernetes-helm
Chart Used:
We will use the Bitnami NGINX chart available from the Bitnami repository.
Step 1: Add the Bitnami Repository and Update
-
Open your terminal.
-
Add the Bitnami Helm repository:
helm repo add bitnami https://charts.bitnami.com/bitnami -
Update your local repository cache:
helm repo update
Step 2: Install the Pre-Made NGINX Chart
-
Install the NGINX chart with a release name (we’ll use “my-nginx”) in the default namespace:
helm install my-nginx bitnami/nginx -
Verify the release installation:
-
List Helm releases:
helm list -
Check the Kubernetes resources created:
kubectl get all -l app.kubernetes.io/name=nginx
-
Step 3: Customize the Chart
-
Retrieve the default values for the chart and save them to a file:
helm show values bitnami/nginx > my-nginx-values.yaml -
Open the file “my-nginx-values.yaml” in your favorite text editor.
-
Make a simple customization. For example, change the number of replicas from 1 to 2 by modifying:
replicaCount: 1to:
replicaCount: 2You can also change other values, such as the service type (e.g., from ClusterIP to LoadBalancer) or image tag.
-
Save your changes.
Step 4: Upgrade the Release with Your Custom Values
-
Upgrade the “my-nginx” release using your modified values file:
helm upgrade my-nginx bitnami/nginx -f my-nginx-values.yaml -
Verify the upgrade:
-
Check the status of the release:
helm status my-nginx -
Use
kubectlto confirm that the number of replicas has increased:kubectl get deployment my-nginx
The Deployment should now show the updated replica count.
-
Step 5: Roll Back the Release
-
If you want to revert the changes and go back to the previous version, execute the rollback command:
helm rollback my-nginx 1(The number “1” refers to the previous revision. You can view the revision history with
helm history my-nginx.) -
Verify that the rollback was successful:
-
Check the release status:
helm status my-nginx -
Confirm with
kubectlthat the Deployment now reflects the previous configuration (e.g., replica count returns to 1).
-
Step 6: Clean Up
-
Once you’ve completed the lab, uninstall the release to clean up resources:
helm uninstall my-nginx -
Verify that all related Kubernetes resources are removed:
kubectl get all -l app.kubernetes.io/name=nginx