Samples on kubernetes helm golang client
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
If you want to manage Helm releases from Go, the usual answer is to use the Helm Go SDK rather than shelling out to the helm CLI. The SDK lets you list, install, upgrade, and uninstall releases programmatically while still using the same chart model as Helm itself. This article shows a minimal setup and a working sample for listing and installing releases.
The Main Packages You Need
The Helm SDK lives under the Helm project modules, especially the action package. A minimal program usually works with:
- '
helm.sh/helm/v3/pkg/action' - '
helm.sh/helm/v3/pkg/cli' - '
helm.sh/helm/v3/pkg/chart/loader' - Kubernetes REST configuration support
Add the dependency in your Go module:
The exact transitive Kubernetes packages will be pulled in automatically.
Initialize the Helm Action Configuration
Before performing actions, initialize action.Configuration. This is the object most Helm operations use internally.
The storage driver argument is often secret, though other drivers exist.
List Releases
Once initialized, listing releases is straightforward.
This is the simplest real sample for proving that your SDK setup is correct.
Install a Local Chart
To install a chart from disk, load it and run an install action.
This example assumes the chart already exists locally and the target namespace is reachable through your current kubeconfig.
Kubeconfig and In-Cluster Behavior
The SDK usually uses the same Kubernetes access conventions as Helm itself. Locally, it often relies on your kubeconfig. Inside a cluster, you may need to ensure the program has in-cluster credentials and the service account permissions required to manage releases.
In practice, most early failures come from cluster authentication or RBAC, not from the Helm API usage itself.
When to Use the SDK Instead of the CLI
Use the Go SDK when:
- you are building an operator or internal platform tool
- release management is part of a larger Go service
- you need programmatic control rather than shelling out
If you just need a few admin scripts, the Helm CLI may still be simpler and easier to maintain.
Watch Version Compatibility
Helm SDK usage is tied to Helm major versions. If your cluster tooling or charts assume Helm v3, make sure your Go dependency is also Helm v3. Mixing examples from different major versions is a common source of confusion.
The Kubernetes client version pulled in transitively can also influence behavior in stricter environments.
Common Pitfalls
- Shelling out to
helmwhen the real requirement is an embedded Go workflow. - Forgetting to initialize
action.Configurationbefore constructing actions. - Blaming Helm SDK code when the actual problem is kubeconfig or RBAC.
- Mixing Helm v2 examples with Helm v3 imports.
- Assuming SDK-based release management removes the need to understand chart values and namespaces.
Summary
- The Helm Go SDK is the standard way to manage Helm releases programmatically from Go.
- Start by initializing
action.Configurationwith a valid Kubernetes client getter. - Use
action.NewListfor listing releases andaction.NewInstallfor installations. - Expect kubeconfig and RBAC issues to be the most common runtime blockers.
- Choose the SDK only when you truly need embedded programmatic control rather than the Helm CLI.
Related reading
- Scalable spring batch job on kubernetes
- Scale down Kubernetes Pods
- Scheduler is not scheduling Pod for DaemonSet in Master node
- script backup namespace,deployment etc.. from kubernetes
- Script for running port-forward automatically
- Script to continuously follow kubectl get pods
- seccompunconfined for a container in a kubernetes pod? Or changing default in docker 1.10?
- Secret management in Helm Charts

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.