Helm is often referred to as the “package manager for Kubernetes”. Much like apt
or yum
In the Linux world, Helm facilitates the definition, installation, and management of Kubernetes applications through something called “charts”. These charts are collections of pre-configured Kubernetes resources, enabling users to deploy and manage complex applications with simple commands. With Helm, the scalability and manageability of applications in a Kubernetes environment becomes remarkably more straightforward.
Table of Contents
Prerequisites
Before diving into the installation of Helm on Ubuntu, ensure you meet the following prerequisites:
- Ubuntu System: Any modern version, preferably 18.04 LTS or later.
- Kubernetes Cluster: Helm will require a running Kubernetes cluster. If you haven’t set one up yet, consider using tools like Minikube
kubeadm
for local or production clusters respectively. - kubectl: Ensure you have
kubectl
installed it and it’s configured to connect to your cluster. - Command-line access: A terminal window or SSH access to your Ubuntu server.
Setting Up the Environment
Updating Your System: Always a good practice, let’s start by ensuring your Ubuntu system is up-to-date:
sudo apt update && sudo apt upgrade -y
Installing Required Tools: While Helm does not strictly require additional tools beyond what’s mentioned in the prerequisites, ensuring that curl
or wget
is available can help download Helm:
sudo apt install -y curl
Installing Helm
Download and Install Helm:
Starting with Helm v3, Tiller (the server-side component of Helm) is no longer required. This means installation is even more straightforward. Here’s how you can download and install Helm:
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
Check Helm Version:
After installation, you can verify that Helm was installed successfully:
helm version
You should see the version details of your Helm installation.
Configuring Helm
Setting Up Repositories:
Helm charts are collected and shared through repositories. By default, Helm does not have any repositories added. The most common starting point is the Helm stable repository:
helm repo add stable https://charts.helm.sh/stable
Updating Helm Repositories:
It’s a good practice to update Helm repositories to fetch the latest charts:
helm repo update
Now, Helm is ready, and you can search, install, or create Helm charts based on your requirements.
Verifying the Installation
Deploying a Test Chart:
One of the best ways to verify your Helm installation is to deploy a sample chart. The nginx
server from the stable repository serves as an excellent example:
helm install nginx-demo stable/nginx-ingress
Once deployed, you can see the Kubernetes resources that have been created:
kubectl get all
You should see resources related to nginx-demo
.
Basic Helm Operations
To effectively use Helm, you’ll need to understand a few basic commands:
Listing Deployed Releases:
helm list
Uninstalling a Release: To uninstall the nginx-demo
release you just installed
helm uninstall nginx-demo
Searching for Charts: To find available charts from your added repositories
helm search repo [chart-name]
Fetching a Chart: This allows you to download a chart to your local directory without installing it
helm pull stable/[chart-name]
Remember, the above commands are just the basics. Helm offers a range of other commands for managing releases, repositories, plugins, and more.
Securing Helm
Even though Helm v3 removed Tiller, which addressed many security concerns, it’s still vital to ensure your Helm setup is secure.
Role-Based Access Control (RBAC): Ensure that your Kubernetes cluster enforces RBAC and that Helm respects these roles. Define roles and role-bindings specifically for Helm operations if necessary.
Namespace Isolation: When installing Helm charts, specify a namespace to prevent unintentional access or collisions between deployments
helm install [release-name] [chart] --namespace [namespace-name]
Private Repositories: Instead of or in addition to public repositories, consider setting up a private Helm repository to store proprietary or customized charts.
Troubleshooting Common Issues
Occasionally, you may run into issues. Here are some tips:
Debug Installation Issues:
Use the --debug
and --dry-run
flags with helm install
to see what Helm is trying to deploy without actually applying the changes.
Check Helm Version: Ensure your Helm CLI version matches with any server-side components or plugins you might be using.
Logs & Descriptions: When a Helm release fails, it’s beneficial to get a description of the failing Kubernetes
kubectl describe [resource-type] [resource-name]
You can also check the logs of pods
kubectl logs [pod-name]
Conclusion
Congratulations! You’ve successfully installed Helm on Ubuntu, learned the basics of its operations, secured your setup, and discovered how to troubleshoot potential issues. With Helm, managing and scaling your Kubernetes applications becomes notably more straightforward. Dive deeper, explore the Helm documentation, and leverage the power of charts to make your Kubernetes journey more efficient and enjoyable.