Master Helm: Essential Commands for Managing Kubernetes Charts
This guide provides a comprehensive overview of Helm, the Kubernetes package manager, covering core commands for searching, pulling, installing, listing, creating charts, managing repositories and dependencies, upgrading, rolling back releases, and pushing charts to Harbor, complete with code examples and usage tips.
Overview
Helm is the package manager for Kubernetes. Common operations include:
helm search – search for charts
helm pull – download a chart to a local directory
helm install – upload a chart to Kubernetes
helm list – list released charts # helm --help Official documentation: https://helm.sh/zh/docs/helm/helm/
Helm Repository (helm repo)
Add, list, delete, update, and index chart repositories.
1) Add a chart repository
helm repo add bitnami https://charts.bitnami.com/bitnami2) List added repositories
helm repo list3) Update local chart information
helm repo update bitnami4) Remove a repository
helm repo remove bitnamiCreate a Chart (helm create)
Creates a new chart directory with common files.
Example: helm create foo creates a structure like:
$ helm create foo
foo/
├── .helmignore # patterns to ignore when packaging
├── Chart.yaml # chart metadata
├── values.yaml # default values for templates
├── charts/ # dependent charts
└── templates/ # template files
└── tests/ # test filesInstall a Chart (helm install)
Installs a chart package. The chart can be a reference, a packaged chart, an unpacked directory, or a URL.
Override values with --values, --set, --set-string, or --set-file:
helm install -f myvalues.yaml myredis ./redis
helm install --set name=prod myredis ./redis
helm install --set-string long_int=1234567890 myredis ./redis
helm install --set-file my_script=dothings.sh myredis ./redisManage Chart Dependencies (helm dependency)
Dependencies are stored in the charts/ directory.
The Chart.yaml file declares dependencies.
Key fields: name (must match the chart name) and version (semantic version or range).
From Helm 2.2.0, repositories can be local paths prefixed with file://:
# Chart.yaml
dependencies:
- name: nginx
version: "1.2.3"
repository: "file://../dependency_chart/nginx"1) List dependencies of a chart
# helm dependency list CHART
helm dependency list wordpress2) Update dependencies
# helm dependency update CHART
helm dependency update wordpressList Releases (helm list)
Lists releases in a namespace (default is the current namespace).
By default shows deployed or failed releases; use --uninstalled or --all to modify behavior.
Maximum 256 items returned; --max changes the limit, --max 0 uses the server default.
Pagination is possible with --max and --offset.
# -A shows all
helm list --max=10 --offset=2 -AUpgrade a Release (helm upgrade)
Upgrades a release to a new chart version. The chart can be a reference, a directory path, a packaged chart, or a URL.
helm upgrade --set foo=bar --set foo=newbar redis ./redisRelease History (helm history)
Retrieves the revision history of a release. By default returns up to 256 revisions; --max adjusts the limit.
Example output:
$ helm history angry-bird
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Mon Oct 3 10:15:13 2016 superseded alpine-0.1.0 1.0 Initial install
2 Mon Oct 3 10:15:13 2016 superseded alpine-0.1.0 1.0 Upgraded successfully
3 Mon Oct 3 10:15:13 2016 superseded alpine-0.1.0 1.0 Rolled back to 2
4 Mon Oct 3 10:15:13 2016 deployed alpine-0.1.0 1.0 Upgraded successfullyRollback a Release (helm rollback)
Rolls back a release to a previous revision. If the revision number is omitted, it rolls back to the previous version.
# View history first
helm history myharbor -n harbor
# Roll back to a specific revision
helm rollback myharbor 1 -n harbor
# Roll back to the previous revision
helm rollback myharbor -n harborShow Chart Details (helm show)
# Show all chart files (values.yaml, Chart.yaml, README)
helm show all mysql
# Show only values.yaml
helm show values mysqlPull a Chart (helm pull)
Download a chart from a repository, optionally untarring it.
# Download only
helm pull bitnami/redis
# Download and untar
helm pull bitnami/redis --untarPackage a Chart (helm package)
Packs a chart directory into a .tgz archive.
Use --sign, --keyring, and --key to sign the package.
helm package mysql/
# Successfully packaged chart and saved it to: /opt/k8s/helm/mysql-9.3.1.tgzTo ignore files, configure a .helmignore file (supports Unix shell glob patterns):
# .helmignore
.git
*/temp*
*/*/temp*
temp?Push Chart to Harbor (helm cm-push)
Pushes a chart to a remote repository.
1) Online installation
helm plugin install https://github.com/chartmuseum/helm-push2) Offline installation
Download the plugin package and extract it into the Helm plugins directory.
# Download package
wget https://github.com/chartmuseum/helm-push/releases/download/v0.10.3/helm-push_0.10.3_linux_amd64.tar.gz
# Extract to plugin path
mkdir /root/.local/share/helm/plugins/helm-push
tar zxvf helm-push_0.10.3_linux_amd64.tar.gz -C /root/.local/share/helm/plugins/helm-push3) Add Harbor repository
# Add a Harbor repo with credentials and CA file
helm repo add local-harbor --username=admin --password=Harbor12345 https://myharbor.com/chartrepo/bigdata/ --ca-file /opt/k8s/helm/ca.crt4) Push examples
# Push a directory
helm cm-push mysql/ local-harbor --ca-file /opt/k8s/helm/ca.crt
# Push a packaged chart
helm cm-push wordpress-15.1.5.tgz local-harbor --ca-file /opt/k8s/helm/ca.crt
# Push with a specific version
helm cm-push mychart/ --version="1.2.3" local-harbor --ca-file /opt/k8s/helm/ca.crt
# Force push
helm cm-push --force mychart-0.3.2.tgz local-harborSearch Hub (helm search hub)
Search charts in Artifact Hub or a private hub instance.
# List all charts
helm search hub
# Search for a specific chart
helm search hub mysqlSearch Repositories (helm search repo)
Searches configured repositories for charts matching a keyword, showing the latest stable version (or pre‑release with --devel ).
# Search stable releases for nginx
helm search repo nginx
# Include pre‑release versions
helm search repo nginx --devel
# Search for a specific major version
helm search repo nginx-ingress --version ^1.0.0Validate a Chart (helm lint)
Runs a series of tests on a chart to verify its format and catch errors or warnings.
# Lint a chart directory
helm lint ./mysqlCommon Helm Commands Summary
helm version // Show Helm version
helm create xxx // Create a new chart named xxx
helm lint ./xxx // Check chart for issues
helm install xxx1 ./xxx // Deploy chart with release name xxx1
helm list // List deployed charts
helm history // Show release history
helm upgrade // Upgrade a release
helm rollback // Roll back a release
helm package ./xxx // Package a chart
helm repo add --username admin --password password myharbor xxx // Add a repo
helm uninstall xxx1 // Uninstall a release
helm pull // Pull a chart package
helm cm-push // Push a chart package
helm repo update // Update repository cache
helm search hub // Search Artifact Hub for charts
helm search repo // Search local repositoriesHelm common commands (chart installation, upgrade, rollback, uninstall, etc.) are covered above; feel free to leave comments for any questions.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
