0
0
KubernetesHow-ToBeginner · 3 min read

How to Install a Helm Chart in Kubernetes

To install a Helm chart, use the helm install command followed by a release name and the chart name or path. This deploys the application defined by the chart into your Kubernetes cluster.
📐

Syntax

The basic syntax to install a Helm chart is:

  • helm install <release-name> <chart>: Installs the chart with a custom release name.
  • <release-name>: A unique name you choose for this deployment.
  • <chart>: The name of the chart from a repository or a local path.
bash
helm install my-release nginx
💻

Example

This example installs the official nginx chart from the stable repository with the release name my-nginx. It deploys nginx on your Kubernetes cluster.

bash
helm repo add stable https://charts.helm.sh/stable
helm repo update
helm install my-nginx stable/nginx
Output
NAME: my-nginx LAST DEPLOYED: Fri Apr 26 12:00:00 2024 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: 1. Get the application URL by running these commands: export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=nginx,app.kubernetes.io/instance=my-nginx" -o jsonpath="{.items[0].metadata.name}") kubectl port-forward $POD_NAME 8080:80 2. Visit http://127.0.0.1:8080 to access your application
⚠️

Common Pitfalls

Common mistakes when installing Helm charts include:

  • Not adding or updating the chart repository before installing, causing Helm to fail finding the chart.
  • Using a release name that already exists, which causes an error.
  • Not having Kubernetes cluster access configured properly.

Always run helm repo update before installing charts and choose unique release names.

bash
helm install stable/nginx
# Wrong: missing release name

helm install my-nginx stable/nginx
# Right: includes release name
📊

Quick Reference

CommandDescription
helm repo add Add a Helm chart repository
helm repo updateUpdate local chart repository cache
helm install Install a chart with a release name
helm listList installed Helm releases
helm uninstall Remove a deployed release

Key Takeaways

Use helm install <release-name> <chart> to deploy a Helm chart.
Always add and update the chart repository before installing charts.
Choose a unique release name to avoid conflicts.
Ensure your Kubernetes cluster is accessible and configured.
Use helm list to check installed releases and helm uninstall to remove them.