How to Install Software on Kubernetes Clusters?

Photo of author

By admin

How to Install Software on Kubernetes clusters?

Kubernetes has a unique package manager, Helm. It assists and permits programmers to configure and install the applications on Kubernetes clusters easily. It provides various functions similar to the package manager in other operating systems;

  • Helm has a helm chart that assists in detecting a standard format and file directory format for packaging the Kubernetes resources.
  • For much famous software, Helm offers a public repository of charts. A third-party repository could be used to get the charts.
  • The Helm client software also includes a command like listing and searching for charts with the keywords and deploying applications to clusters. One can also remove applications and manage the functions.

Thus, Helm has a crucial role in installing software in Kubernetes clusters.

If you want to learn how Helm assist in deploying apps in Kubernetes, then this article is for you;

Step 1: Installing Helm

First, you have to install the helm command-line utility on the machine. The helm offers a script that will manage the installation process on macOS, Windows, and Linux.

Download the script and to a writable folder;

cd /tmp

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > install-helm.sh

Then you have to create a script with chmod;

chmod u+x install-helm.sh

Now, with your preferred text editor, you can open the script and check it thoroughly. After checking carefully, run the script;

./install-helm.sh

Then you will need to enter the password and click Enter.

Output

helm installed into /usr/local/bin/helm

Run ‘helm init’ to configure helm.

The installation will be further finished by installing some helm components on the cluster.

Step 2: Installing Tiller

Helm command is mainly associated with Tiller. This command runs on a cluster and gets the commands from the helm by interacting with the Kubernetes API. Kubernetes API handles the task of making and removing the resources.

For permitting the Tiller to run on a cluster, you have to create a kubernetes serviceaccount resource.

To create the serviceaccount for Tiller, enter the command;

kubectl -n kube-system create serviceaccount tiller

Further, the Cluster-admin role must be bind with the tiller serviceaccount;

kubectl -n kube-system create serviceaccount Tiller

Then you can run the helm init, it will help you to install Tiller on your cluster, including local housekeeping process likes downloading stable repo details;

helm init –service-account tiller

Output

. . .

Tiller has been installed into your Kubernetes Cluster.

Note: Tiller is installed with an insecure ‘allow unauthenticated users’ policy, by default.

To check whether the Tiller is running, you have to list the pods in kube-system namespace;

kubectl get pods –namespace kube-system

Output

NAME READY STATUS RESTARTS AGE

. . .

kube-dns-64f766c69c-rm9tz 3/3 Running 0 22m

kube-proxy-worker-5884 1/1 Running 1 21m

kube-proxy-worker-5885 1/1 Running 1 21m

kubernetes-dashboard-7dd4fc69c8-c4gwk 1/1 Running 0 22m

tiller-deploy-5c688d5f9b-lccsk 1/1 Running 0 40s

 

You can find the Tiller name as states tiller-deploy-.

Up to now, You have successfully installed both Helm and Tiller. Now the helm is ready to use for the installation of applications.

Step 3: Installing Helm chart

Helm charts are the helm software packages. Chart repository known as stable comes inbuilt with Heml.

To install the Kubernetes-dashboard packages from the stable repo, you can use helm;

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

Check the NAME line, in the output section. If you find it written as dashboard-demo, then it is the name of your release. The helm releases a single installation of charts with a particular configuration.

You can likewise deploy numerous charts with their own configuration.

However, if you are unable to find the release name, it is possible that Helm would name it randomly for you.

To get the list of releases on cluster, from the Helm, enter the below command;

helm list

Output

NAME REVISION UPDATED STATUS CHART NAMESPACE

dashboard-demo 1 Wed Aug 8 20:11:11 2018 DEPLOYED kubernetes-dashboard-0.7.1 default

If you want to check any new service deployed on the cluster, you can utilize the kubectl.

kubectl get services

Output

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

dashboard-demo-kubernetes-dashboard ClusterIP 10.32.104.73 <none> 443/TCP 51s

kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 34m

The Helm release name and chart name could be the combination of the service name with your release.

As of now, you have deployed the application successfully. Helm will change the configuration, and deployment will be updated.

Step 4: Updating the Release

If you want to upgrade the release with the latest update chart, you can use the command helm upgrade.

To know about the upgrade and rollback process of the dashboard demo, you can check the example process; To update the name of dashboard service to the dashboard, rather than dashboard-demo-kubernetes-dashboard.

The detailed fullnameOverride configuration for controlling the service name is provided by the Kubernetes-dashboard chart.

helm upgrade dashboard-demo stable/kubernetes-dashboard –set fullnameOverride=”dashboard”

You can check the similar output with the initial helm install setup.

To check the kubernetes services shows the update terms, enter the command;

kubectl get services

output

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 36m

dashboard ClusterIP 10.32.198.148 <none> 443/TCP 40s

The service has been updated correctly.

Step 5: Rolling back a Release

After the update of the release, if you want to roll back the release, this step will guide you.

You have formed a second revision of the release, once you updated the dashboard-demo. However, helm kept all the old details of releases, if you want to roll back to the old configuration.

You can enter the helm list to check the release;

helm list

Output

NAME REVISION UPDATED STATUS CHART NAMESPACE

dashboard-demo 2 Wed Aug 8 20:13:15 2018 DEPLOYED kubernetes-dashboard-0.7.1 default

In the Output section, you can find the Revision column that shows the second revision.

To roll back to the first revision, use the command;

helm rollback dashboard-demo 1

The output depicts the rollback is successfully placed.

Output

Rollback was a success! Happy Helming!

Now, while running the kubectl get service again, you will notice the service name is changed to the old value, which states that a re-deploy has been done by the Helm on the application with 1st configuration.

Thereafter, for removing the releases, check the next step.

Step 6: Deleting a Release

To delete the Helm release, use the command helm delete;

helm delete dashboard-demo

You will notice that the release is removed successfully, which will stop the dashboard application automatically.

As you know that helm saves the revisions, if the user wants to re-deploy the release.

You will get an error, in case you try to install helm with a new dashboard-demo.

To get the list of deleted released, you can use the command –deleted;

helm list –deleted

If you want to actually remove the release and want the previous version, you can use the –purge flag with the command helm delete;

helm delete dashboard-demo –purge

After this, the release is permanently removed.

Conclusion

In a nutshell, you have got all the information on installing software on the Kubernetes cluster using Helm. Moreover, the above steps display the installation with helm command tools and its associated tiller service. Installing applications, upgrading, rolling back to the previous release, and deleting the Helm charts will assist in the process.

Leave a Comment