Skip to main content
graphwiz.aigraphwiz.ai
← Back to Cheatsheets

Helm CLI Cheat Sheet

DevOpsKubernetes
helmkuberneteschartscheatsheetreference

Helm CLI Cheat Sheet

A practical quick-reference guide for Helm, the Kubernetes package manager. Commands are organized by workflow: installing, managing releases, working with charts, and troubleshooting.

Key Concepts

Before diving into commands, understand these core concepts:

ConceptDescription
ChartA package containing Kubernetes resource templates, default values, and metadata
ReleaseA specific instance of a chart running in a cluster with its own configuration
RevisionA numbered snapshot of a release, created on each install/upgrade/rollback
RepositoryA collection of charts stored remotely (HTTP) or locally
ValuesConfiguration parameters that customize chart behavior

Values Files and Overriding

Helm merges values in this order (later overrides earlier):

  1. Chart's values.yaml (defaults)
  2. Parent chart values (for subcharts)
  3. User-supplied -f values.yaml files (multiple allowed)
  4. --set and --set-file arguments

Installation Commands

Basic Install

# Install a chart with default values
helm install my-release bitnami/nginx

# Install in a specific namespace (namespace must exist)
helm install my-release bitnami/nginx -n production

# Install with a custom release name from a local chart
helm install myapp ./my-chart
```text

### Install with Custom Values

```bash
# Override values from a file
helm install my-release bitnami/nginx -f values.yaml

# Override multiple values files (later files override earlier)
helm install my-release bitnami/nginx -f base.yaml -f override.yaml

# Set individual values inline
helm install my-release bitnami/nginx --set replicaCount=3

# Set nested values
helm install my-release bitnami/nginx --set image.tag=1.25.0

# Set multiple values
helm install my-release bitnami/nginx \
  --set replicaCount=3 \
  --set service.type=LoadBalancer
```text

### Install with Verification

```bash
# Dry run to see generated manifests without installing
helm install my-release bitnami/nginx --dry-run

# Dry run with debug output (shows computed values)
helm install my-release bitnami/nginx --dry-run --debug

# Verify chart before install (runs helm test after install)
helm install my-release bitnami/nginx --wait

# Install with timeout (default is 5m)
helm install my-release bitnami/nginx --timeout 10m
```text

### Install from Different Sources

```bash
# From OCI registry
helm install my-release oci://registry.example.com/charts/nginx:1.0.0

# From absolute URL
helm install my-release https://example.com/charts/nginx-1.0.0.tgz

# From a specific chart version
helm install my-release bitnami/nginx --version 15.0.0
```text

## Release Management

### List Releases

```bash
# List releases in current namespace
helm list

# List releases in all namespaces
helm list -A

# List releases in a specific namespace
helm list -n production

# Show all releases including deleted (kept for history)
helm list --all

# Filter by release name pattern
helm list --filter 'my-*'

# Output in different formats
helm list -o json
helm list -o yaml
```text

### Release Status and History

```bash
# Get status of a release
helm status my-release

# Get status in a specific namespace
helm status my-release -n production

# View release history
helm history my-release

# History with maximum revisions
helm history my-release --max 10
```text

### Uninstall Releases

```bash
# Uninstall a release
helm uninstall my-release

# Uninstall from a specific namespace
helm uninstall my-release -n production

# Keep history after uninstall (allows rollback)
helm uninstall my-release --keep-history

# Dry run uninstall
helm uninstall my-release --dry-run
```text

## Upgrade and Rollback

### Upgrade Releases

```bash
# Upgrade to latest chart version
helm upgrade my-release bitnami/nginx

# Upgrade with new values
helm upgrade my-release bitnami/nginx -f values.yaml

# Upgrade with inline values
helm upgrade my-release bitnami/nginx --set replicaCount=5

# Upgrade to a specific chart version
helm upgrade my-release bitnami/nginx --version 16.0.0

# Upgrade and install if release does not exist
helm upgrade --install my-release bitnami/nginx -f values.yaml

# Force resource updates through replacement
helm upgrade my-release bitnami/nginx --force
```text

### Upgrade with Safety Options

```bash
# Wait for resources to be ready
helm upgrade my-release bitnami/nginx --wait

# Wait with custom timeout
helm upgrade my-release bitnami/nginx --wait --timeout 10m

# Rollback on failure (automatic rollback if upgrade fails)
helm upgrade my-release bitnami/nginx --atomic

# Cleanup on failure (deletes new resources on failure)
helm upgrade my-release bitnami/nginx --cleanup-on-fail
```text

### Rollback Releases

```bash
# Rollback to previous revision
helm rollback my-release

# Rollback to a specific revision
helm rollback my-release 3

# Rollback in a specific namespace
helm rollback my-release 3 -n production

# Dry run rollback
helm rollback my-release --dry-run
```text

## Chart Operations

### Create Charts

```bash
# Create a new chart skeleton
helm create my-chart

# Create with a specific starter
helm create my-chart --starter bitnami/nginx
```text

### Package Charts

```bash
# Package a chart directory into a .tgz file
helm package ./my-chart

# Package with a specific version
helm package ./my-chart --version 1.2.3

# Package with app version
helm package ./my-chart --app-version 2.0.0

# Package with signature
helm package ./my-chart --sign --key 'John Doe'
```text

### Lint and Validate

```bash
# Lint a chart for issues
helm lint ./my-chart

# Lint with strict mode (warnings as errors)
helm lint ./my-chart --strict

# Lint with values file
helm lint ./my-chart -f values.yaml
```text

### Pull and Download

```bash
# Download a chart without installing
helm pull bitnami/nginx

# Download a specific version
helm pull bitnami/nginx --version 15.0.0

# Download and extract
helm pull bitnami/nginx --untar

# Download to specific directory
helm pull bitnami/nginx -d ./charts/

# Download from OCI registry
helm pull oci://registry.example.com/charts/nginx:1.0.0
```text

### Inspect Charts

```bash
# Show all chart information
helm show all bitnami/nginx

# Show only chart.yaml contents
helm show chart bitnami/nginx

# Show default values
helm show values bitnami/nginx

# Show README
helm show readme bitnami/nginx

# Show from a packaged chart
helm show values ./nginx-15.0.0.tgz

# Combine outputs
helm show chart bitnami/nginx && helm show values bitnami/nginx
```text

## Repository Management

### Add and List Repositories

```bash
# Add a chart repository
helm repo add bitnami https://charts.bitnami.com/bitnami

# Add with authentication
helm repo add private https://charts.example.com \
  --username user --password pass

# List configured repositories
helm repo list

# List output as JSON
helm repo list -o json
```text

### Update and Remove

```bash
# Update all repositories (fetch latest index)
helm repo update

# Update specific repository
helm repo update bitnami

# Remove a repository
helm repo remove bitnami

# Remove multiple repositories
helm repo remove bitnami stable
```text

### Index and Search

```bash
# Generate index file for a chart directory
helm repo index ./charts/

# Generate index with base URL
helm repo index ./charts/ --url https://charts.example.com

# Merge with existing index
helm repo index ./charts/ --merge index.yaml

# Search for charts by keyword
helm search repo nginx

# Search all repositories
helm search hub nginx

# Search with regex
helm search repo 'nginx$'

# Show all versions (not just latest)
helm search repo nginx --versions

# Filter by version constraint
helm search repo nginx --version '>=15.0.0'
```text

## Values Management

### Inspect Values

```bash
# Get all computed values for a release
helm get values my-release

# Get values in a specific namespace
helm get values my-release -n production

# Get values for a specific revision
helm get values my-release --revision 3

# Get all values including defaults
helm get values my-release --all

# Output as YAML (default)
helm get values my-release -o yaml

# Output as JSON
helm get values my-release -o json
```text

### Set Values Syntax

```bash
# Simple value
--set name=value

# Nested value (uses dot notation)
--set image.tag=1.25.0

# Array/list values (use array index)
--set servers[0].name=web1
--set servers[1].name=web2

# Array shorthand
--set names={web1,web2,web3}

# Values with special characters (escape or quote)
--set "pod.annotations.kubernetes\.io/name"=myapp

# Read value from file
--set-file config=./config.txt

# Use string value (preserves type)
--set-string enabled=true
```text

### Values Files

```bash
# Use a values file
helm install my-release bitnami/nginx -f values.yaml

# Use multiple values files
helm install my-release bitnami/nginx \
  -f base.yaml \
  -f env/prod.yaml

# Generate values file template
helm show values bitnami/nginx > values.yaml
```text

## Template and Debug

### Render Templates

```bash
# Render templates without installing
helm template my-release bitnami/nginx

# Render with values file
helm template my-release bitnami/nginx -f values.yaml

# Render to a directory
helm template my-release bitnami/nginx --output-dir ./rendered/

# Render specific templates only
helm template my-release bitnami/nginx -s templates/deployment.yaml

# Render with release name simulation
helm template my-release ./my-chart --release-name
```text

### Debug Commands

```bash
# Debug with dry run (shows computed values and manifests)
helm install my-release bitnami/nginx --dry-run --debug

# Debug template rendering issues
helm template my-release ./my-chart --debug

# Validate rendered manifests server-side
helm template my-release bitnami/nginx | kubectl apply --dry-run=client -f -
```text

## Dependency Management

### Work with Dependencies

```bash
# Download chart dependencies
helm dependency update ./my-chart

# List dependencies
helm dependency list ./my-chart

# Build dependencies from Chart.lock
helm dependency build ./my-chart
```text

### Chart.yaml Dependencies

```yaml
# Example Chart.yaml with dependencies
apiVersion: v2
name: my-app
version: 1.0.0
dependencies:
  - name: redis
    version: "17.x.x"
    repository: https://charts.bitnami.com/bitnami
    condition: redis.enabled
  - name: postgresql
    version: "12.x.x"
    repository: https://charts.bitnami.com/bitnami
    alias: database
```text

## Plugin Management

### Install and Use Plugins

```bash
# Install a plugin
helm plugin install https://github.com/helm/helm-mapkubeapis

# Install from local directory
helm plugin install ./helm-plugin

# List installed plugins
helm plugin list

# Uninstall a plugin
helm plugin uninstall mapkubeapis

# Update a plugin
helm plugin update helm-diff
```text

## Release Information

### Get Detailed Release Info

```bash
# Get user-supplied values
helm get values my-release

# Get rendered manifests
helm get manifest my-release

# Get release notes
helm get notes my-release

# Get hooks (job templates)
helm get hooks my-release

# Get everything combined
helm get all my-release

# Get from a specific revision
helm get manifest my-release --revision 2

# Get from specific namespace
helm get manifest my-release -n production
```text

## Testing

### Test Releases

```bash
# Run helm tests for a release
helm test my-release

# Test with timeout
helm test my-release --timeout 5m

# Clean up test pods after running
helm test my-release --cleanup

# Test in a specific namespace
helm test my-release -n production

# View test logs
kubectl logs my-release-test-connection
```text

### Test Pod Example

Charts define tests in `templates/tests/`. A test hook looks like:

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: "{{ .Release.Name }}-test-connection"
  annotations:
    "helm.sh/hook": test
spec:
  containers:
    - name: wget
      image: busybox
      command: ['wget']
      args: ['{{ .Release.Name }}:{{ .Values.service.port }}']
  restartPolicy: Never
```text

## Common Patterns

### Production Install Pattern

```bash
helm upgrade --install myapp ./chart \
  -n production \
  --create-namespace \
  -f values/production.yaml \
  --set image.tag=${CI_COMMIT_SHA} \
  --atomic \
  --timeout 10m \
  --wait \
  --history-max 10
```text

### Diff Before Upgrade (with helm-diff plugin)

```bash
# Preview changes before applying
helm diff upgrade my-release bitnami/nginx -f values.yaml

# Diff with three-way merge view
helm diff upgrade my-release bitnami/nginx --three-way-merge
```text

### Multi-Environment Values

```bash
# Directory structure
# values/
#   base.yaml
#   development.yaml
#   staging.yaml
#   production.yaml

helm upgrade --install myapp ./chart \
  -f values/base.yaml \
  -f values/production.yaml
```text

### Secret Management

```bash
# Set sensitive values from environment
helm install my-release bitnami/postgresql \
  --set postgresqlPassword="${DB_PASSWORD}" \
  --set-string postgresqlPassword="${DB_PASSWORD}"

# Use --set-file for secrets from files
helm install my-release ./chart \
  --set-file ssl.cert=/path/to/cert.pem
```text

## Quick Reference

| Command | Purpose |
| --------- | --------- |
| `helm install` | Create a new release |
| `helm upgrade` | Update an existing release |
| `helm rollback` | Revert to a previous revision |
| `helm uninstall` | Delete a release |
| `helm list` | Show releases |
| `helm status` | Show release details |
| `helm history` | Show revision history |
| `helm get values` | Show release values |
| `helm get manifest` | Show rendered YAML |
| `helm repo add` | Add a chart repository |
| `helm repo update` | Fetch latest chart indexes |
| `helm search` | Find charts |
| `helm pull` | Download a chart |
| `helm template` | Render templates locally |
| `helm lint` | Validate chart syntax |
| `helm test` | Run chart tests |

## Next Steps

- [Kubernetes kubectl Cheat Sheet](/devops/kubernetes-cheatsheet/) — Essential kubectl commands
- [Docker CLI Cheat Sheet](/devops/docker-cheatsheet/) — Build container images
- [Kubernetes GitOps with ArgoCD](/posts/kubernetes-gitops-argocd/) — Declarative deployments with Helm