Managing Releases
1. Listing Active Releases
| Command | Description | Flags |
|---|---|---|
| helm list | List all active Helm releases in the current namespace | -n, --namespace to specify namespace--short to show only release names |
| helm list -n production | List all active releases in the production namespace |
Example: Listing Helm Releases
helm list -n production
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
my-app production 1 2025-04-05 10:30:00 deployed my-app-1.0.0 1.0.0
nginx production 2 2025-04-04 15:45:00 deployed nginx-1.20.0 1.20.0
Note: By default,
helm list only shows releases with the deployed status. Use --all to include failed or superseded releases.
2. Listing All Releases
| Command | Description | Flags |
|---|---|---|
| helm list | List all releases in the cluster | -q for quiet mode, --namespace to filter by namespace |
| helm list --short | Display only release names | --short flag |
| helm list --namespace <namespace> | List releases in a specific namespace | --namespace flag with namespace name |
Note: By default,
helm list shows releases in the current namespace. Use --all-namespaces to list across all namespaces.
3. Filtering by Namespace
| Filter Type | Description | Usage |
|---|---|---|
| --namespace | Filter releases by namespace | helm list --namespace my-namespace |
| --all-namespaces | List releases across all namespaces | helm list --all-namespaces |
4. Listing Across Namespaces
| Field | Description | Example |
|---|---|---|
| helm list --all-namespaces | List all releases across all namespaces | helm list --all-namespaces |
| helm list -A | Short form for listing across all namespaces | helm list -A |
Example: Listing Releases Across Namespaces
helm list -A
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
my-app default 1 2024-05-20 10:30:00 deployed nginx-1.0.0 1.20.1
redis production 2 2024-05-21 14:45:00 deployed redis-7.0.0 7.0.0
5. Getting Release Status
| Command | Description | Example |
|---|---|---|
| helm status | Displays the status of the named release | helm status my-release |
| helm status -o yaml | Outputs the status in YAML format | helm status my-release -o yaml |
| helm status --version | Shows the status of a specific release version | helm status my-release --version 1 |
Note: The status includes information about the release's health, revision number, and any issues.
6. Getting Release Values
| Property | Description | Example |
|---|---|---|
| helm get values | Fetches the values of a release | helm get values my-release |
| helm get values -o yaml | Fetches the values in YAML format | helm get values my-release -o yaml |
| helm get values --all | Fetches all values including defaults | helm get values my-release --all |
7. Getting Release Manifest
| Property | Description | Example |
|---|---|---|
| helm get manifest | Retrieves the Kubernetes manifests for a release | helm get manifest my-release |
| --namespace | Specifies the namespace of the release | helm get manifest my-release --namespace=my-namespace |
| --all | Includes all resources, including those not managed by Helm | helm get manifest my-release --all |
Example: Retrieve Manifest in Specific Namespace
helm get manifest my-release --namespace production
8. Getting Release Notes
| Command | Description | Flags |
|---|---|---|
| helm get notes | Fetches the release notes for a specific release | --version, --namespace |
Note: Release notes are stored during the installation or upgrade process and can be retrieved at any time using this command.
9. Getting Release Hooks
| Hook Type | Description | Usage | Notes |
|---|---|---|---|
| pre-install | Runs before resources are installed | For setup tasks like database schema creation | Use for initializing dependencies before chart installation |
| post-install | Runs after resources are installed | For post-deployment tasks like sending notifications | Use for finalizing setup or verifying deployment success |
| pre-upgrade | Runs before resources are upgraded | For backup or pre-upgrade checks | Use to ensure data integrity before upgrade |
| post-upgrade | Runs after resources are upgraded | For post-upgrade validation or cleanup | Use to verify upgrade success or clean up temporary files |
| pre-delete | Runs before resources are deleted | For cleanup or backup tasks | Use to archive data or perform cleanups before deletion |
| post-delete | Runs after resources are deleted | For logging or cleanup tasks | Use to log deletion or clean up external resources |
| pre-rollback | Runs before rollback occurs | For backup or pre-rollback checks | Use to ensure rollback can proceed safely |
| post-rollback | Runs after rollback occurs | For post-rollback validation or cleanup | Use to verify rollback success or clean up temporary files |
| test | Runs when tests are executed | For validating chart functionality | Use to run integration or functional tests |
Example: Defining a pre-install Hook
apiVersion: batch/v1
kind: Job
metadata:
name: init-db
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
spec:
containers:
- name: init-db
image: postgres:13
command: ["/bin/sh", "-c", "psql -U user -d db -c 'CREATE TABLE IF NOT EXISTS logs (id SERIAL, message TEXT);'"]
restartPolicy: Never
Note: Hook weights control execution order. Lower values execute first.
Warning: Hooks are not guaranteed to run in a specific order if they have the same weight.
10. Filtering Release Output
| Filter | Description | Example |
|---|---|---|
| --output | Specify output format for release information | helm list --output json |
| --short | Print only release names | helm list --short |
| --filter | Filter releases by status (deployed, failed, pending) | helm list --filter deployed |
| --namespace | Limit output to a specific namespace | helm list --namespace production |
| --max | Limit the number of releases shown | helm list --max 5 |