Installing and Configuring Helm on Kubernetes

Tutorial 2 of 5

1. Introduction

In this tutorial, we will learn how to install and configure Helm for Kubernetes. Helm is a package manager for Kubernetes that allows developers and operators to more easily package, configure, and deploy applications and services onto Kubernetes clusters.

By the end of this tutorial, you will have a working Helm installation on your system and be able to deploy a test application to your Kubernetes cluster using Helm.

Prerequisites

  • A working Kubernetes cluster
  • Basic knowledge of Kubernetes and its command-line tool, kubectl
  • A system with curl or wget installed

2. Step-by-Step Guide

Installing Helm

  1. Download the latest version of Helm:
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
  1. Make the script executable:
chmod 700 get_helm.sh
  1. Run the script to install Helm:
./get_helm.sh
  1. Verify the installation:
helm version

You should see version information for Helm, similar to the following:

version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}

Configuring Helm

  1. Create a Service Account for Tiller (the server-side component of Helm):
kubectl -n kube-system create serviceaccount tiller
  1. Create a cluster role binding to give Tiller admin access to the entire cluster:
kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
  1. Initialize Helm and install Tiller on your cluster:
helm init --service-account tiller
  1. Verify the installation:
kubectl get pods --namespace kube-system

You should see a pod named tiller-deploy-* in the running state.

3. Code Examples

Deploying a Test Application

  1. Add the Bitnami repository to Helm:
helm repo add bitnami https://charts.bitnami.com/bitnami
  1. Install the bitnami/nginx chart:
helm install my-webserver bitnami/nginx

This command installs the nginx web server with the name my-webserver.

  1. Verify the deployment:
kubectl get services

You should see a service named my-webserver with an external IP.

4. Summary

In this tutorial, you have installed and configured Helm on your system, and deployed a test application to your Kubernetes cluster using Helm. You can now use Helm to manage your Kubernetes applications and services more easily.

5. Practice Exercises

  1. Install a different Helm chart of your choice.
  2. Configure Helm to use a different Kubernetes namespace for deployments.
  3. Create a simple Helm chart for a basic web application.

Remember to use the helm and kubectl commands to verify your deployments.