Helm is a package manager for Kubernetes that helps you manage Kubernetes applications. Below are the steps to install and uninstall Helm packages (also known as Helm charts).
Prerequisites
- Kubernetes Cluster: Ensure you have a running Kubernetes cluster.
- Helm Installed: Install Helm on your local machine or cluster. Follow the official Helm installation guide if you haven't already.
- Kubeconfig: Ensure your
kubeconfig is configured to access your cluster.
Installing Helm Packages
1. Add a Helm Repository (Optional)
Helm charts are often stored in repositories. Add a repository to access charts:
helm repo add [REPO_NAME] [REPO_URL]
Example:
helm repo add bitnami https://charts.bitnami.com/bitnami
2. Update Helm Repositories
Update the local cache of charts from the repositories:
helm repo update
3. Search for a Chart
Search for a chart in the repositories:
helm search repo [KEYWORD]
Example:
helm search repo nginx
4. Install a Helm Chart
Install a chart into your Kubernetes cluster:
helm install [RELEASE_NAME] [CHART_NAME]
Example:
helm install my-nginx bitnami/nginx
[RELEASE_NAME]: A unique name for this installation (e.g., my-nginx).
[CHART_NAME]: The name of the chart (e.g., bitnami/nginx).
5. Customize Installation (Optional)
You can customize the installation using a values.yaml file or by passing command-line arguments:
helm install my-nginx bitnami/nginx -f custom-values.yaml
Or:
helm install my-nginx bitnami/nginx --set service.type=LoadBalancer
Uninstalling Helm Packages
1. List Installed Helm Releases
List all installed Helm releases in your cluster:
helm list
2. Uninstall a Helm Release
Uninstall a release using its [RELEASE_NAME]:
helm uninstall [RELEASE_NAME]
Example:
helm uninstall my-nginx
3. Purge Resources (Optional)
By default, helm uninstall removes the release but keeps the history. To purge the release history, use the --purge flag (deprecated in Helm 3, as history is automatically deleted):
helm uninstall [RELEASE_NAME] --purge
Additional Tips
- Dry Run: Test an installation without applying it:
helm install [RELEASE_NAME] [CHART_NAME] --dry-run
- Upgrade a Release: Upgrade an existing release:
helm upgrade [RELEASE_NAME] [CHART_NAME]
- Rollback a Release: Roll back to a previous revision:
helm rollback [RELEASE_NAME] [REVISION]
Troubleshooting
By following these steps, you can easily install and uninstall Helm packages in your Kubernetes cluster.