- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Helm Commands Cheat Sheet
Helm is a package manager for Kubernetes that simplifies the installation and management of software in a Kubernetes cluster. It provides an easy way to package, deploy, and manage applications on top of Kubernetes. This tool allows developers to create reusable charts that can be shared with others, making it easier to manage complex applications in a consistent manner.
Helm consists of two main components: the Helm client and the Helm server. The client is used to interact with the server and manage charts, while the server contains all the necessary information about available charts.
Basic Helm Commands
Helm Install: Installing Your First Chart
The helm install command is the most basic command for installing charts. A chart is a bundle of Kubernetes resources that can be deployed with a single Helm command.
The syntax for installing a chart with Helm is "helm install [name-of-release] [chart-name]". The name-of-release can be any name that you choose, and it will be used as an identifier for your deployment.
helm install [name-of-release] [chart-name]
The chart-name should be the name of the chart that you are deploying. When you run this command, Helm will pull down the specified chart from its repository and install it on your Kubernetes cluster.
Helm Upgrade: Updating Your Deployments
The helm upgrade command is used to update an existing deployment to a new version of the same chart or to modify some parameters of an already running release. Its syntax is "helm upgrade [name-of-release] [chart-name]".
helm upgrade [name-of-release] [chart-name]
This command updates all corresponding Kubernetes resources with changes specified in the new version of the Chart. It also supports passing custom values, which allows users to modify certain template values at runtime.
Helm List: Viewing Deployed Charts
The helm list command displays all releases currently deployed in your cluster. You can use this command to monitor and manage your deployments as needed. The syntax for this command is simply "helm list", which returns details about each release including their names, status, revision number, and more.
Helm Uninstall: Removing Existing Charts
If you want to remove a deployed application from your Kubernetes cluster, you can use the helm uninstall command followed by the name of the release that you want to delete. For example, "helm uninstall [name-of-release]" will delete all resources associated with that release from your cluster. This helps ensure there are no lingering resources left over after deleting your application.
Advanced Helm Commands
Adding Repositories With Helm Repo Add
Helm provides an easy way to add a new repository to your local environment using the command "helm repo add". This command requires two arguments: the name of the repository and its URL.
Once you have added a new repository, you can search for charts in it as if they were part of the default repositories. For example, to add the Bitnami Helm chart repository −
$ helm repo add bitnami https://charts.bitnami.com/bitnami
Updating Repositories With Helm Repo Update
It is important to keep your local copy of chart repositories up-to-date. You can update all repositories at once by running "helm repo update".
This command will fetch the latest information on available packages from all configured repositories. In case only one specific repository needs to be updated, then you can use −
$ helm repo update
Searching Charts With Helm Search
If you want to find out what charts are available in the configured repositories, use "helm search". This command will provide a list of all available charts that match a given keyword or filter. In case only one specific repository needs to be searched for packages then you can use −
$ helm search -r
Linting Charts With Helm Lint
Linting is essential when creating charts from scratch. Running "helm lint" on your chart verifies that everything is correctly formatted and that the chart is free of errors.
This command can save a lot of time and headache by catching simple mistakes before they become critical issues. To use it, navigate to the directory where your chart is located and run −
$ helm lint
The command will return a list of possible issues found in the chart. You can fix them before packaging or installing your chart.
Customizing Charts with Helm Commands
Helm commands give users the power to create and customize charts that suit their needs. In this section, we will explore four advanced helm commands used for chart customization: helm create, helm package, helm install --name my-release, and helm upgrade --set key=value.
helm create helm package helm install --name my-release helm upgrade --set key=value
Helm Create: Crafting Your Own Chart
The Helm Create command allows users to create a new chart which can be customized as needed. When using this command, Helm generates a new chart directory with some default files such as the Chart.yaml file which contains the metadata of the chart.
Users can further customize this file by adding details like versioning or providing dependencies of the chart. Additionally, the templates folder contains Kubernetes manifests that have placeholders for variables that can be easily replaced during installation or via upgrades.
One benefit of using Helm Create is that it provides an excellent starting point for creating charts from scratch. This makes it easy for developers to package their applications as charts and share them with others who may need to deploy those applications across different environments.
Helm Package: Bundling your Chart
The Helm Package command allows users to bundle their custom chart into an archive that others can deploy in production environments easily. This archive format is called a 'chart package'. The packaged version of the chart may include added customizations such as additional configuration files or templates.
Helm packages are extremely useful when implementing Continuous Integration/Continuous Deployment (CI/CD) pipelines because they provide an efficient way to distribute application updates. Developers can automate building and packaging their application codebase into a chart at each stage of development and finally promote these packages up to production.
Helm Install --name my-release: Installing a Chart with a Custom Name
The Helm Install command deploys the chart onto a Kubernetes cluster. This command supports an optional flag '--name' which allows the user to specify a unique name for their release. When installing different charts, this feature comes in handy since it prevents releases from overwriting each other.
For instance, if you are deploying two different versions of an application on the same cluster, you can use '--name' to distinguish between them. When running "helm list" command later on, both releases will be listed separately by name.
Helm Upgrade --set key=value: Updating Your Release
The Helm Upgrade command is used to update an existing release to a newer version or change its configuration. The '--set' flag can be used to update values in the release's configuration file(s) that have changed from its initial deployment values. These values could include secrets and passwords.
To use this feature, you need to provide key/value pairs specifying new values for these configurations when running helm upgrade command. For instance, if your application requires enabling HTTPS Protocol during runtime due to security reasons, you can pass --set https.enabled=true as an argument while upgrading your application's chart.
In this article, we have explored the basics and advanced Helm commands that make up a comprehensive Helm Commands Cheat Sheet. We have seen how to install, upgrade, list, and uninstall Helm charts with ease using the basic commands.
The advanced commands like adding a repository, updating a repository, searching for charts and linting are also crucial in customizing your charts as per your requirements. We have looked at important tips and tricks to help you avoid common mistakes when using the cheat sheet.
Kickstart Your Career
Get certified by completing the courseGet Started