🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Helm Commands Reference

Basic Commands

  1. helm install: This command is used to install a chart and create a new release. Example: helm install my-release stable/mysqlUse case: Installing a MySQL database using the stable/mysql chart.
  2. helm upgrade: This command is used to upgrade a release to a new version of a chart or modify its configuration.Example: helm upgrade my-release stable/mysql --set mysqlRootPassword=newpasswordUse case: Upgrading the my-release MySQL database to a new version and changing the root password.
  3. helm rollback: This command is used to roll back a release to a previous version.Example: helm rollback my-release 1 Use case: Reverting the my-release MySQL database to version 1 after encountering issues with version 2.
  4. helm delete: This command is used to delete a release and free up the resources associated with it.Example: helm delete my-release Use case: Removing the my-release MySQL database from the Kubernetes cluster.
  5. helm list: This command is used to list all the installed releases.Example: helm listUse case: Checking the list of installed releases in the cluster.
  6. helm status: This command is used to get the status of a release.Example: helm status my-releaseUse case: Checking the status of the my-release MySQL database.
  7. helm search: This command is used to search for available charts in Helm repositories.Example: helm search repo mysqlUse case: Searching for available MySQL-related charts in Helm repositories.
  8. helm dependency update: This command is used to download the dependencies for a chart.Example: helm dependency update my-chartUse case: Downloading the dependencies required for the custom chart named my-chart.

Intermediate Commands

  1. helm repo add: This command is used to add a Helm repository to your local environment.Example: helm repo add stable https://charts.helm.sh/stableUse case: Adding the stable repository to your local Helm environment to access charts from the stable repository.
  2. helm repo update: This command is used to update the local cache of Helm repositories.Example: helm repo updateUse case: Refreshing the local cache to ensure that you have the latest versions of the charts from the added repositories.
  3. helm lint: This command is used to lint a chart to validate its syntax and configuration.Example: helm lint my-chartUse case: Checking the syntax and configuration of a custom chart named my-chart to ensure it is valid.
  4. helm package: This command is used to package a chart directory into a compressed chart archive.Example: helm package my-chartUse case: Creating a compressed chart archive from a chart directory named my-chart to distribute or install it locally.
  5. helm history: This command is used to view the release history of a chart.Example: helm history my-releaseUse case: Viewing the history of the my-release chart, including the revision numbers, dates, and statuses of the previous releases.
  6. helm show: This command is used to display information about a chart or a release.Example: helm show chart stable/mysqlUse case: Displaying information about the stable/mysql chart, such as its description, maintainers, and dependencies.
  7. helm template: This command is used to render a chart locally without installing it.Example: helm template my-chartUse case: Generating the Kubernetes manifests from a chart named my-chart without deploying it, useful for inspection or customization purposes.

Deploying a Chart to Kubernetes Cluster

# Confirm Helm version
$ helm version
# Add a helm repository to use the charts in the following demos
# using this custom repository as the charts in the stable repository have been deprecated.
$ helm repo add stable https://charts.helm.sh/stable
# Search for a chart
$ helm search repo stable/mysql
# confirm current context
$ kubectl config current-context
# test connection to cluster
$ kubectl get nodes
# list helm repositories
$ helm repo list
# search repository for a mysql chart
$ helm search repo stable/mysql
# show chart definition
$ helm show chart stable/mysql
# show chart README
$ helm show readme stable/mysql
# pipe README to file
$ helm show readme stable/mysql > C:\Temp\README.txt
# show chart values
$ helm show values stable/mysql > C:\Temp\values.txt
# test deployment of chart
$ helm install mysql stable/mysql --dry-run --debug
# deploy chart
$ helm install mysql stable/mysql
# confirm deployment
$ helm list

Retrieving information about a Release

# view deployments
$ helm list
# view status of release
$ helm status mysql
# get release manifests
$ helm get manifest mysql > C:\Temp\manifests.txt
# get release values - no user values were supplied so file will be blank
$ helm get values mysql > C:\Temp\values.txt
# get release notes
$ helm get notes mysql > C:\Temp\notes.txt
# get all from release
$ helm get all mysql > C:\Temp\all.txt
# view kubernetes objects
$ kubectl get all
# view release history
$ helm history mysql
# uninstall a release
$ helm uninstall mysql --keep-history
# confirm
$ helm list
# confirm with --all flag
$ helm list --all
# delete release
$ helm delete mysql
# confirm with --all flag
$ helm list --all

Upgrading a Release

# search the repository for a chart
$ helm search repo stable/mysql
# search the stable repository for a chart and retrieve the different versions (2 in the repo)
$ helm search repo stable/mysql --versions
# install a specific version of the chart
$ helm install mysql stable/mysql --version 1.6.3
# confirm release deployed
$ helm list
# view kubernetes objects
$ kubectl get all
# upgrade the release
$ helm upgrade mysql stable/mysql --version 1.6.4
# confirm release upgraded
$ helm list
# view history of release
$ helm history mysql
# view kubernetes objects
$ kubectl get all

Rolling back a Release

# view release
helm list
# view release history
helm history mysql
# view kubernetes objects
kubectl get all
# view replicasets
kubectl get replicasets
# rollback release
helm rollback mysql 1
# view release history
helm history mysql
# view kubernetes objects
kubectl get all
# view replicasets
kubectl get replicasets
# view secrets
kubectl get secrets
###################################################################################################
# Rolling back without the old replicaset
###################################################################################################
# clean up previous release
helm delete mysql
# deploy specific version of chart
helm install mysql stable/mysql --version 1.6.3
# upgrade release
helm upgrade mysql stable/mysql --version 1.6.4
# confirm history
helm history mysql
# view kubernetes objects
kubectl get all
# view replicasets
kubectl get replicaset
# delete old replicaset - replace NAME with the old replicaset name
kubectl delete replicaset NAME
# confirm deletion
kubectl get replicaset
# try a rollback with kubectl - will fail as we have deleted the old replicaset
kubectl rollout undo deployment/mysql
# but we still have the history of the release in Helm
helm history mysql
# rollback with helm
helm rollback mysql 1
# confirm status of release
helm list
# confirm rollback
helm history mysql
# view replicaset
kubectl get replicaset
# the old replicaset is back!
# this is due to the release history being stored as secrets in the k8s cluster
kubectl get secrets
# let's a look at one of those secrets
kubectl get secret sh.helm.release.v1.mysql.v1 -o yaml
$ kubectl get secret sh.helm.release.v1.mysql.v1 -o jsonpath="{ .data.release }" | base64 -d | base64 -d | gunzip -c | jq '.chart.templates[].data' | tr -d '"' | base64 -d
# the secret is encoded. For further information on decoding these secrets, see here: -
# https://dbafromthecold.com/2020/08/10/decoding-helm-secrets/

Helm Tutorials: helm show commands

helm show chart: Displays the information and metadata of a chart.
$ helm show chart mychart
helm show readme: Shows the README file of a chart.
helm show readme mychart
helm show values: Displays the default values.yaml file of a chart.
$ helm show values mychart
helm show all: Shows all the information available for a chart, including its metadata, README, and values.
$ helm show all mychart
Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x