Post

Helm Commands

Helm Commands

Helm Commands

Commonly Used Helm Commands with Examples

Helm is a powerful package manager for Kubernetes, simplifying the deployment and management of applications. In this blog, we will cover commonly used Helm commands, providing an example for each, explaining the output columns, and detailing the system changes where applicable.

Commonly Used Commands

CommandDescription
helm repo addAdd a new Helm chart repository.
helm repo updateUpdate information of available charts locally.
helm search repoSearch for charts in the Helm repositories.
helm installInstall a Helm chart.
helm upgradeUpgrade a release to a new chart or version.
helm rollbackRoll back a release to a previous revision.
helm listList all Helm releases.
helm uninstallUninstall a Helm release.
helm show valuesDisplay the default values of a chart.
helm templateRender chart templates locally without installing.

Understanding Helm Commands with –help

  • Before diving into specific commands, you can use the --help flag to understand what a Helm command does.
1
helm install --help
  • Example Output:
Install a chart archive.

Usage:
  helm install [NAME] [CHART] [flags]

Flags:
  -f, --values stringArray   specify values in a YAML file
  --generate-name            generate a release name if not provided
  --set stringArray          set values on the command line
  • This provides an overview of how to use the command, its arguments, and available flags.

Installing a Helm Chart

  • Command:
1
helm install my-release bitnami/nginx
  • Example Output:
NAME: my-release
LAST DEPLOYED: Fri Mar 15 12:30:00 2025
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
...
  • Output Column Details:
    • NAME: The name of the release.
    • LAST DEPLOYED: Timestamp of deployment.
    • NAMESPACE: Kubernetes namespace where the release is deployed.
    • STATUS: Indicates if the deployment was successful.
    • REVISION: The release version.
  • System Changes:
    • A Kubernetes deployment for nginx is created along with associated services and pods.

Listing Installed Helm Releases

  • Command:
1
helm list
  • Example Output:
NAME        	NAMESPACE	REVISION	UPDATED         	STATUS  	CHART       	APP VERSION
my-release 	default  	1       	2025-03-15 12:30	deployed	nginx-13.2.9	1.21.6
  • Output Column Details:
    • NAME: Name of the Helm release.
    • NAMESPACE: Kubernetes namespace.
    • REVISION: Number of times the release has been updated.
    • UPDATED: Last modification timestamp.
    • STATUS: Current status (e.g., deployed, failed, superseded).
    • CHART: Chart name and version.
    • APP VERSION: Application version of the installed chart.
  • System Changes:
    • No changes; this command only fetches and displays release information.

Upgrading a Helm Release

  • Command:
1
helm upgrade my-release bitnami/nginx --set image.tag=latest
  • Example Output:
Release "my-release" has been upgraded. Happy Helming!

NAME: my-release
LAST DEPLOYED: Fri Mar 15 12:45:00 2025
NAMESPACE: default
STATUS: deployed
REVISION: 2
  • System Changes:
    • The deployment is updated with the new nginx image tag.
    • The revision number is incremented.

Rolling Back a Release

  • Command:
1
helm rollback my-release 1
  • Example Output:
Rollback was a success! Happy Helming!
  • System Changes:
    • The application is restored to revision 1.
    • Any changes introduced in newer revisions are undone.

Uninstalling a Release

  • Command:
1
helm uninstall my-release
  • Example Output:
1
release "my-release" uninstalled
  • System Changes:
    • All Kubernetes resources associated with my-release are deleted.

    Upgrading a Helm Release with Reuse Values and Custom Values

    • Command:
    1
    
    helm upgrade my-release bitnami/nginx --reuse-values -f custom-values.yaml
    
    • Example Output:
    Release "my-release" has been upgraded. Happy Helming!
    
    • System Changes:
      • The deployment is upgraded while retaining the values from the previous release (--reuse-values).
      • Additional custom values from the custom-values.yaml file are applied during the upgrade.
    • Use Case:
      • The --reuse-values flag is helpful when you want to preserve existing configurations while applying new changes.
      • The -f flag allows you to specify additional customizations, making it easier to tailor upgrades without losing prior settings.

Upgrading a Helm Release with Atomic and Cleanup on Fail

  • Command:
1
helm upgrade my-release bitnami/nginx --atomic --cleanup-on-fail
  • Example Output:
Release "my-release" has been upgraded. Happy Helming!
  • System Changes:
    • The deployment is upgraded only if all resources are successfully updated.
    • If the upgrade fails, all changes are rolled back automatically, ensuring no partial updates remain.
  • Use Case:
    • This is particularly useful in production environments where partial upgrades can lead to inconsistent states. The --atomic flag ensures all-or-nothing upgrades, while --cleanup-on-fail removes any failed resources to maintain a clean state.

Conclusion

Helm provides a straightforward way to manage Kubernetes applications. By understanding these commands and their effects, you can efficiently deploy, upgrade, and maintain your applications. Use helm –help to explore additional options and fine-tune your Helm workflows.

This post is licensed under CC BY 4.0 by the author.