The application that is a package manager for Kubernetes applications is none other than Helm. In the last couple of years, there is tremendous growth in the Kubernetes, and so has the ecosystem available to support it. Recently, Cloud Native Computing Foundation (CNCF) has announced Helm as an incubating project that demonstrates its growing popularity among Kubernetes users.
The format of the file that is being used is a YAML file form called Charts. Charts are used to describe, install, and update Kubernetes. They are a prototype sort and they support even the most complex Kubernetes applications. Charts are built to be easy to produce and maintain and can be exchanged and used for Kubernetes publishing.
We’ll explain the basics of Helm and show what a powerful tool it can be for working with Kubernetes resources.
Benefits of Using Helm with Kubernetes
This is indeed one of the most common questions and that is what are the benefits of the service when using Helm with Kubernetes. Well, with this said, the below mentioned is the answer to all this question.
- Deployment Speed: A Helm map can quickly be deployed into a Kubernetes cluster. Either pull down a GitHub project with the Helm chart that you are planning to deploy, or give the Chart name from the desired Helm repository. The Consul-Helm repository can be pulled from GitHub, or from the default Helm repository hosted by Google.
- Application Testing: You’re not alone in this – engineers have built Helm maps to guide you. Like any engineer with testing in mind, they expect failure and design around it. You’ll appreciate the number of tests available in several of the Helm map repos. The tests can range from proper load-testing to simple config testing, to ensure that your services run properly.
Prerequisites For Installing And Using Helm?
- A Kubernetes version 1.8 + cluster, enabled with Role-Based Access Control (RBAC).
- The command-line tool kubectl installed on your local machine, configured to c
kubectl cluster-info |
If you see no errors, you’re connected to the cluster. If you access multiple clusters with kubectl, be sure to verify that you’ve selected the correct cluster context:
kubectl config get-contexts |
Your output should look like:
CURRENT NAME CLUSTER AUTHINFO * do-nyc1-k8s-example do-nyc1-k8s-exam do-nyc1-k8s-example-admin docker-for-desktop docker-for-desktop-cluster docker-for-desktop |
In this example the asterisk (*) indicates that we are connected to the do-nyc1-k8s-example cluster.
Creating A Kubernetes Deployment Using Helm Chart
1. Installing Helm
First, we’re going to install the Helm command-line utility on our localhost. Helm provides a script that will handle the macOS, Windows, or Linux installation process.
Change to a writable directory, and download the GitHub repository script from Helm:
cd /tmp curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > install-helm.sh |
Make the script executable with chmod:
chmod u+x install-helm.sh |
If you’re satisfied with it, run the following:
./install-helm.sh |
2. Installing A Helm Chart
Packages of Helm software are called charts. Helm comes pre-configured with a collection of curated charts called a stable. In their GitHub repos, you can search all of the available charts. Next, as an example, we’ll be installing the Kubernetes Dashboard.
Use Helm to install kubernetes-dashboard from the stable repo package:
helm install stable/kubernetes-dashboard –name dashboard-demo |
Output NAME: dashboard-demo LAST DEPLOYED: Wed Aug 8 20:11:07 2018 NAMESPACE: default STATUS: DEPLOYED . . . |
For a list of releases on this cluster, enter the following:
helm list |
Our output should look like:
NAME REVISION UPDATED STATUS CHART dashboard-demo 1 Aug 8 20:11:11 2018 DEPLOYED kubernetes-dashboard-0.7. |
Now we can use kubectl to check the deployment of a new service on the cluster:
kubectl get services |
Now, our output should look like:
NAME TYPE CLUSTER-IP dashboard-demo-kubernetes-dashboard ClusterIP 10.32.104.73 kubernetes ClusterIP 10.32.0.1 |
3. Updating A Release
The helm upgrade command can be used with a new or updated chart to upgrade a release or to update the configuration options.
To demonstrate the update and rollback process, we’ll make a simple change to our dashboard demo release: we’ll update the dashboard service name to the dashboard only, instead of the dashboard demo-Kubernetes-dashboard.
The kubernetes-dashboard chart provides a configuration option for fullnameOverride control of the name of the service. Let’s upgrade to helm with this set of options:
helm upgrade dashboard-demo stable/kubernetes-dashboard –set fullnameOverride=”dashboard” |
Check to see if the updated values reflect your Kubernetes services:
kubectl get service |
Next, our output should look like:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) kubernetes ClusterIP 10.32.0.1 443/TCP dashboard |
4. Rolling Back a Release
We created a second modification of the release when we updated our dashboard-demo release in the previous step. Thankfully, Helm retains all previous release details in case you need to roll back to a previous configuration or chart.
To inspect the release again use the helm list:
helm list |
The output should look like:
NAME REVISION UPDATED STATUS CHART dashboard-demo 2 Aug 8 20:13:15 2018 DEPLOYED kubernetes-dashboard-0.7.1 |
To roll back to the first revision use helm rollback:
helm rollback dashboard-demo 1 |
You should see the following output, indicating that the rollback succeeded:
Rollback was a success! Happy Helming! |
5. Deleting A Release
Helm releases can be deleted with the Helm delete command:
helm delete dashboard-demo |
Now, our output should look like:
release “dashboard-demo” deleted |
If you were trying to install a new dashboard-demo release right now, you would have an error.
Error: a release named dashboard-demo already exists. |
If you use the –deleted flag to list your deleted releases, you’ll see that the release still exists:
helm list –deleted |
Next, our output should look like:
NAME REVISION UPDATED STATUS CHART dashboard-demo 3 Aug 8 20:15:21 2018 DELETED kubernetes-dashboard-0.7.1 |
Use –purge flag with helm delete command to really delete the release and purge all old revisions:
helm delete dashboard-demo –purge |
Now the release has been completely removed, and the release name can be reused.
Conclusion:
This blog is totally based on the command that will help the team to understand and make their work easier, simpler, and along with that data-driven. Cloud Stack Group is the leading company that assists clients in migrating their server onto the cloud or opting for AWS services which is the latest and the on-going demand for major companies.