If you’ve ever worked with Kubernetes, you know it’s powerful—but it’s also a bit of a beast. Multiple services, configurations everywhere, and YAML files that make you want to pull your hair out. Wouldn’t it be great if there was a way to simplify all this?
Helm – the Kubernetes package manager that turns chaos into harmony. Let’s take a look at how Helm can make your life easier (and more fun!) with a real-world example.
What is Helm?
Helm is a package manager for Kubernetes. If you’ve ever worked with Linux, you’re probably familiar with package managers like apt
or yum
. Helm is similar to these but tailored for Kubernetes. It simplifies the deployment and management of applications in your Kubernetes clusters by using Helm charts.
A Helm chart is a collection of pre-configured Kubernetes resources (like Deployments, Services, ConfigMaps, etc.) bundled together to deploy your app with a single command. This means no more manually writing or managing long YAML files for every resource you deploy—Helm handles it for you!
Real-Life Scenario:
Imagine you’re working on a project with a team of developers, and you need to deploy an application that has multiple components: a frontend service, a backend API, and a database. Each of these components needs its own set of configurations—Deployments, Services, Secrets, and ConfigMaps. Managing all these configurations manually can be overwhelming and error-prone.
How do you efficiently manage this complexity and ensure everything is in sync across different environments?
That’s where Helm comes in. Helm allows you to bundle everything into one neat package called a chart, making it easy to deploy, scale, and manage your app with just a few commands.
Solution:
Instead of manually creating and managing each Kubernetes resource, Helm lets you define all your resources in a single Helm chart, which can be reused across different environments and easily customized using values files.
With Helm, you can:
Package Kubernetes resources into charts.
Share charts and use public repositories (like Helm Hub).
Upgrade or roll back releases with simple commands.
Basic Helm Usage Example
Let’s walk through the basics of using Helm with practical examples.
Installing Helm
First, you’ll need to install Helm. You can easily do this on macOS via Homebrew:
brew install helm
For other platforms, check the official Helm installation guide.Creating a New Helm Chart
Now that Helm is installed, let’s create a simple chart for a fictional app called
my-app
. This will generate the basic file structure for you:helm create my-app
This creates a directory calledmy-app/
with pre-configured templates for Kubernetes resources, includingdeployment.yaml
,service.yaml
, and others. You can modify these templates to suit your application needs.my-app/ ├── charts/ # Contains any dependent charts (subcharts) ├── templates/ # Kubernetes resource templates (like Deployment, Service, etc.) │ ├── deployment.yaml │ ├── service.yaml │ ├── configmap.yaml │ └── ingress.yaml ├── values.yaml # Default values for the chart (can be overridden) └── Chart.yaml # Metadata about the chart (name, version, etc.)
Installing Your Chart
Once your chart is ready, it’s time to deploy your app to Kubernetes. Use the
helm install
command to install the chart. This will package all your resources and deploy them to your cluster:helm install my-app ./my-app
This installs the chart and deploys all the necessary resources defined in the chart’s templates.Upgrading Your Chart
If you need to update your app—maybe you added a new feature or changed the configuration—you can easily modify the resources in your chart. After updating the files, use the
helm upgrade
command:helm upgrade my-app ./my-app
This updates the existing deployment with your changes, without needing to delete or re-create resources.
Helm Commands for Managing Repositories, Rollbacks, and More
Let’s take a deeper dive into more Helm commands that can be helpful in real-world scenarios.
Helm Repositories
Helm allows you to store and share charts in repositories. You can use public repositories (like Helm Hub) or host your own.
To add a Helm repository to your setup:
helm repo add bitnami https://charts.bitnami.com/bitnami
Now, you can search the Bitnami charts and install any application from that repository:helm search repo bitnami helm install my-mysql bitnami/mysql
This command installs the MySQL chart from the Bitnami repository.Listing Helm Releases
To list all the releases installed in your cluster, use:
helm list
This shows all the applications you’ve installed via Helm and their current statuses (like running, failed, etc.).Viewing Release History
Helm keeps a history of all releases, allowing you to track changes over time. To view the history of a release:
helm history my-app
This will show all previous versions of themy-app
release and provide timestamps, revision numbers, and status of each deployment.Rolling Back a Release
If something goes wrong with your update or you want to roll back to a previous version of your app, Helm makes it easy:
helm rollback my-app 2
This command rolls back the release to revision 2, effectively undoing the most recent changes and restoring your app to a stable state.Uninstalling a Chart
If you want to completely remove a release from your cluster, use:
helm uninstall my-app
This deletes all the resources associated with the chart, including deployments, services, and any other objects.
Conclusion
With Helm, you can simplify the deployment, management, and scaling of complex applications in Kubernetes. Whether you’re working with a team or deploying on your own, Helm charts provide a streamlined way to package your resources and manage them efficiently.
The best part? You don’t have to manually write and manage individual YAML files anymore. Helm takes care of that for you, making Kubernetes deployment fast, reliable, and fun!
But wait... there’s more! 🌟
Stay Tuned for Our Next Blog: Introducing Helmfile
While Helm is an incredible tool for managing individual applications, Helmfile takes Helm a step further by allowing you to manage multiple Helm charts with a single file. In the next blog, we’ll dive deep into Helmfile and explore how it can simplify managing complex Kubernetes environments with multiple applications. If you’ve ever felt overwhelmed by managing multiple Helm releases, this is the blog you won’t want to miss!
Made it this far ?! Kudos !! Stay ahead—subscribe to the EzyInfra Knowledge Base for more DevOps Intricacies.
EzyInfra.dev – Expert DevOps & Infrastructure consulting! We help you set up, optimize, and manage cloud (AWS, GCP) and Kubernetes infrastructure—efficiently and cost-effectively. Need a strategy? Get a free consultation now!
Share this post