> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing Helm Chart

> Guide to install Helm and deploy kube-prometheus-stack to provision Prometheus Alertmanager and observability components on a Kubernetes cluster, including installation, configuration, verification, and uninstallation.

In this lesson you'll install Helm and deploy the kube-prometheus-stack Helm chart to provision Prometheus, Alertmanager, and related observability components on a Kubernetes cluster. The guide walks through installing Helm, adding the Prometheus Community repo, inspecting and customizing chart values, installing the chart, verifying the deployment, and uninstalling the release.

## 1) Install Helm

Follow the official Helm documentation for platform-specific instructions: [https://helm.sh/docs/](https://helm.sh/docs/)

Typical Linux install (official script):

```bash theme={null}
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
```

Install via package managers:

```bash theme={null}
# macOS (Homebrew)
brew install helm

# Windows (Chocolatey)
choco install kubernetes-helm

# Windows (Scoop)
scoop install helm
```

For other package managers (APT, YUM, etc.), see the Helm docs linked above.

Verify Helm is installed:

```bash theme={null}
helm version
```

Example output (your version/build info may differ):

```bash theme={null}
version.BuildInfo{Version:"v3.10.2", GitCommit:"50f003e5ee8704ec937a756c646870227d7c8b58", GitTreeState:"clean", GoVersion:"go1.18.8"}
```

## 2) Add the Prometheus Helm repository and update

Add the Prometheus Community chart repository and refresh your local index:

```bash theme={null}
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

Typical update output when the repo already exists:

```bash theme={null}
"prometheus-community" already exists with the same configuration, skipping
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "prometheus-community" chart repository
Update Complete. ⚓Happy Helming!⚓
```

<Callout icon="lightbulb" color="#1CB2FE">
  The release name you provide when installing a chart (for example `prometheus` in this guide) is arbitrary. Choose any valid name; just be consistent when running `helm upgrade`, `helm uninstall`, or when querying resources by label.
</Callout>

## 3) Inspect chart values (optional but recommended)

Charts expose many configurable values. To view the kube-prometheus-stack defaults:

```bash theme={null}
helm show values prometheus-community/kube-prometheus-stack
```

Save defaults to a file for customization:

```bash theme={null}
helm show values prometheus-community/kube-prometheus-stack > values.yaml
```

A short illustrative excerpt from `values.yaml`:

```yaml theme={null}
## Provide a name in place of kube-prometheus-stack for `app:` labels
nameOverride: ""

## Override the deployment namespace
namespaceOverride: ""

## Provide a k8s version to auto dashboard import script example: kubeTargetVersionOverride: 1.16.6
kubeTargetVersionOverride: ""

## Labels to apply to all resources
commonLabels: {}
  scmhash: abc123

## Service configuration example
externalTrafficPolicy: Cluster
type: ClusterIP

servicePerReplica:
  enabled: false
  annotations: {}

port: 9093
targetPort: 9093
nodePort: 30904
```

Edit `values.yaml` to adjust namespace, persistence, resource requests/limits, scrape settings, alerting configuration, and dashboard imports.

<Callout icon="lightbulb" color="#1CB2FE">
  To deploy with your custom values file, pass it during install or upgrade: `helm install prometheus prometheus-community/kube-prometheus-stack -f values.yaml` (or `helm upgrade --install prometheus ... -f values.yaml`).
</Callout>

## 4) Install the chart

Install the chart with default values:

```bash theme={null}
helm install prometheus prometheus-community/kube-prometheus-stack
```

Or install using your customized values:

```bash theme={null}
helm install prometheus prometheus-community/kube-prometheus-stack -f values.yaml
```

Example installation summary:

```bash theme={null}
NAME: prometheus
LAST DEPLOYED: Mon Nov 21 13:22:39 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
kube-prometheus-stack has been installed. Check its status by running:
  kubectl --namespace default get pods -l "release=prometheus"

Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator.
```

Verify pods and other resources created by the release:

```bash theme={null}
kubectl --namespace default get pods -l "release=prometheus"
kubectl --namespace default get svc -l "release=prometheus"
kubectl --namespace default get pvc -l "release=prometheus"
```

## 5) Uninstall the release

Remove the release and associated resources created by the chart:

```bash theme={null}
helm uninstall prometheus
```

If you deployed to a namespace other than `default`, append `--namespace <namespace>` to both install and uninstall commands.

## Quick reference: common commands

| Action                  | Command                                                                                 |
| ----------------------- | --------------------------------------------------------------------------------------- |
| Add repo                | `helm repo add prometheus-community https://prometheus-community.github.io/helm-charts` |
| Update repos            | `helm repo update`                                                                      |
| Inspect values          | `helm show values prometheus-community/kube-prometheus-stack`                           |
| Save values             | `helm show values prometheus-community/kube-prometheus-stack > values.yaml`             |
| Install (defaults)      | `helm install prometheus prometheus-community/kube-prometheus-stack`                    |
| Install (custom)        | `helm install prometheus prometheus-community/kube-prometheus-stack -f values.yaml`     |
| Upgrade (apply changes) | `helm upgrade prometheus prometheus-community/kube-prometheus-stack -f values.yaml`     |
| Uninstall               | `helm uninstall prometheus`                                                             |
| Verify pods             | `kubectl get pods -l "release=prometheus"`                                              |

## Summary

* Install Helm (script or package manager) and verify with `helm version`.
* Add the `prometheus-community` Helm repository and run `helm repo update`.
* Optionally inspect and customize chart defaults with `helm show values` and a `values.yaml` file.
* Install the kube-prometheus-stack chart: `helm install <release-name> prometheus-community/kube-prometheus-stack` (use `-f values.yaml` to apply customizations).
* Verify resources using `kubectl` and remove the release with `helm uninstall <release-name>`.

## Links and references

* [Helm Documentation](https://helm.sh/docs/)
* [Prometheus Community Helm Charts](https://prometheus-community.github.io/helm-charts)
* [kube-prometheus Repository](https://github.com/prometheus-operator/kube-prometheus)

This article will be followed by a deeper look at the Kubernetes resources the kube-prometheus-stack chart creates and how Prometheus, Alertmanager, and the operator are configured.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/prometheus-certified-associate-pca/module/bb958f66-38c3-41ed-ae2f-7a4ee96c4d66/lesson/601c8a1d-c743-457e-85e5-a39ea757c476" />
</CardGroup>
