Install and Configure Helm on Ubuntu 24.04

Install and configure Helm on Ubuntu 23.10

Learn how to install and configure Helm on Ubuntu 23.10 with this comprehensive guide. Follow step-by-step instructions to set up Helm, manage Kubernetes applications, and customize deployments using Helm charts. Ideal for Kubernetes users looking to streamline their workflow.

Table of Contents

Introduction

Helm is a powerful package manager for Kubernetes, facilitating the management of Kubernetes applications. If you’re running Ubuntu 23.10 and want to leverage Helm for your Kubernetes deployments, you’re in the right place. This guide will walk you through installing and configuring Helm on Ubuntu 23.10, ensuring you’re up and running quickly.

Why Use Helm?

Before diving into the installation process, let’s briefly discuss why Helm is an essential tool for Kubernetes users.

  • Simplified Management: Helm allows you to manage complex Kubernetes applications with ease.
  • Versioning: It enables versioning of your applications, making rollbacks straightforward.
  • Reusable Charts: Helm uses charts, which are reusable templates for Kubernetes resources.
Install and configure Helm on Ubuntu 23.10

Photo by admingeek from Infotechys

Prerequisites

Before you start, ensure you have the following:

  • A machine running Ubuntu 23.10.
  • Kubernetes cluster up and running (you can use Minikube for local testing).
  • Basic knowledge of Kubernetes and command-line operations.

Install and Configure Helm on Ubuntu 23.10: Step-by-step Instructions

Start by taking care of the obvious–updating your system to ensure all packages are current. Open your terminal and run:

				
					sudo apt update && sudo apt upgrade -y
				
			

NOTE: The apt-key method was deprecated in Debian and its derivatives, including Ubuntu, with the release of Debian 11 (Bullseye) and Ubuntu 20.04 LTS (Focal Fossa). The deprecation was officially noted in the release notes and documentation. Users are now encouraged to use the /etc/apt/trusted.gpg.d directory for storing GPG keys instead of relying on the apt-key utility, which is planned for removal in the future.

Step 1: Install Helm

To install Helm, follow these steps:

I. Add the Helm Repository

First, add the Helm repository to your package manager with the following commands:

				
					curl https://baltocdn.com/helm/signing.asc -o /tmp/helm-signing.asc
				
			
				
					sudo gpg --dearmor -o /usr/share/keyrings/helm.gpg /tmp/helm-signing.asc
				
			

Now that the key is correctly stored, add the Helm repository using the modern keyring method:

				
					echo "deb [signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
				
			
				
					deb [signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main
				
			

Update the package list to reflect the changes:

				
					sudo apt update
				
			
				
					Hit:1 http://us.archive.ubuntu.com/ubuntu mantic InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu mantic-updates InRelease
Hit:3 http://security.ubuntu.com/ubuntu mantic-security InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu mantic-backports InRelease
Hit:4 https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.30/deb  InRelease                                
Hit:6 https://baltocdn.com/helm/stable/debian all InRelease                                                                            
Reading package lists... Done                         
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

				
			

II. Helm Install and Version Check

Run the following command to install Helm:

				
					sudo apt install helm -y
				
			

To verify the installation, run:

				
					helm version
				
			
				
					version.BuildInfo{Version:"v3.15.1", GitCommit:"e211f2aa62992bd72586b395de50979e31231829", GitTreeState:"clean", GoVersion:"go1.22.3"}
				
			

Step 2: Configure Helm

With Helm installed, it’s time to configure it for your Kubernetes cluster.

I. Initialize Helm

Helm 3 does not require server-side components like Helm 2 (Tiller), simplifying the setup process. To initialize Helm, you simply need to add a Helm repository.

				
					helm repo add stable https://charts.helm.sh/stable
				
			

To add the ingress-nginx repository to Helm, you can use the following command:

				
					helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
				
			
This command will add the official ingress-nginx Helm chart repository to your Helm configuration.

II. Update the Repositories

After adding the repository, update your Helm repositories to ensure you have the latest information:

				
					helm repo update
				
			
				
					Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈
				
			

III. Install a Helm Chart

As an example, let’s install the NGINX ingress controller using Helm. This is a common use case for managing ingress resources in Kubernetes.

				
					helm install my-nginx-ingress ingress-nginx/ingress-nginx
				
			

To verify the installation, check the status:

				
					helm status my-nginx-ingress
				
			
				
					NAME: my-nginx-ingress
LAST DEPLOYED: Fri Jun 21 12:50:54 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
It may take a few minutes for the load balancer IP to be available.
You can watch the status by running 'kubectl get service --namespace default my-nginx-ingress-ingress-nginx-controller --output wide --watch'

An example Ingress that makes use of the controller:
  apiVersion: networking.k8s.io/v1
  kind: Ingress
...omitted for brevity...
				
			

Step 3: Using Helm Charts

Helm charts simplify the deployment process. A Helm chart is a collection of files that describe a related set of Kubernetes resources. Here’s a simple structure of a Helm chart:

Directory/FileDescription
mychart/Root directory of the Helm chart
Chart.yamlInformation about the chart
values.yamlDefault values for the chart
charts/Directory for dependency charts
templates/Directory for Kubernetes resource templates

This table provides a clear and organized view of the typical structure and components of a Helm chart directory.

Customizing Helm Charts

You can customize Helm charts by editing the values.yaml file. For instance, to change the replica count for an application, you would modify the values.yaml file like this:

				
					replicaCount: 3
				
			

Below is a sample values.yaml file for a hypothetical application. This file defines default values that can be customized during the Helm chart installation.

				
					# Default values for myapp.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# Application-specific configurations
app:
  name: myapp
  version: 1.0.0
  replicaCount: 3
  image:
    repository: myapp-image
    tag: latest
    pullPolicy: IfNotPresent

# Service configuration
service:
  type: LoadBalancer
  port: 80

# Ingress configuration
ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
  hosts:
    - host: myapp.local
      paths:
        - /
  tls:
    - secretName: myapp-tls
      hosts:
        - myapp.local

# Resource requests and limits
resources:
  requests:
    memory: "64Mi"
    cpu: "250m"
  limits:
    memory: "128Mi"
    cpu: "500m"

# Node selector for scheduling
nodeSelector: {}

# Tolerations for node taints
tolerations: []

# Affinity rules for pod scheduling
affinity: {}

# Configuration for liveness and readiness probes
livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 30
  timeoutSeconds: 5

readinessProbe:
  httpGet:
    path: /readiness
    port: 8080
  initialDelaySeconds: 5
  timeoutSeconds: 3

# Environment variables for the application
env:
  - name: DATABASE_URL
    value: postgres://user:password@db:5432/myapp
  - name: REDIS_URL
    value: redis://redis:6379

# Persistent volume claims
persistence:
  enabled: true
  accessMode: ReadWriteOnce
  size: 1Gi
  storageClass: standard

# Logging configuration
logging:
  level: info
  format: json

# Custom configuration for additional features
customConfig: {}
				
			

Explanation of Key Sections

app: Defines basic application details like the name, version, number of replicas, and image details.

service: Configures the Kubernetes service, specifying the type and port.

ingress: Sets up ingress rules, enabling access to the application via an ingress controller with optional TLS.

resources: Specifies resource requests and limits for the application’s containers.

nodeSelector, tolerations, affinity: Provide options for scheduling pods on specific nodes based on labels, taints, and affinity rules.

livenessProbe, readinessProbe: Define health checks to ensure the application is running and ready to serve traffic.

env: Lists environment variables to be passed to the application.

persistence: Configures persistent storage for the application, defining access modes, size, and storage class.

logging: Specifies logging levels and formats.

customConfig: Placeholder for any additional custom configurations.

This values.yaml file can be customized as needed for different deployments of your Helm chart.

Troubleshooting

If you encounter issues, consider the following steps:

Check Helm Logs:

Use kubectl logs to check for any errors in your Helm-managed pods.

Helm Help:

The helm help command is invaluable for discovering Helm’s capabilities and troubleshooting common issues.

Conclusion

Installing and configuring Helm on Ubuntu 23.10 is a straightforward process that can significantly enhance your Kubernetes management capabilities. By following this guide, you should have a fully functional Helm setup, ready to deploy and manage applications in your Kubernetes cluster.

Helm simplifies complex deployments and provides powerful tools for managing Kubernetes resources, making it an essential tool for any Kubernetes administrator. Keep exploring Helm’s capabilities to fully leverage its potential.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *