This blog post covers setting up a Kubernetes cluster on Ubuntu 23.10. Follow our step-by-step guide to set up a robust and scalable Kubernetes environment
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.
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.
Before diving into the installation process, let’s briefly discuss why Helm is an essential tool for Kubernetes users.
Photo by admingeek from Infotechys
Before you start, ensure you have the following:
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.
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"}
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
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...
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/File | Description |
---|---|
mychart/ | Root directory of the Helm chart |
Chart.yaml | Information about the chart |
values.yaml | Default 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: {}
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.
If you encounter issues, consider the following steps:
Check Helm Logs: | Use |
---|---|
Helm Help: | The |
Additional Resources |
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
This blog post covers setting up a Kubernetes cluster on Ubuntu 23.10. Follow our step-by-step guide to set up a robust and scalable Kubernetes environment
Are you looking to set up a Kubernetes development environment with Vagrant quickly and efficiently? Look no further! In this guide, we’ll walk through how
Learn how to upgrade Ubuntu 23.10 to 24.04 with our comprehensive step-by-step guide. Ensure a smooth transition with pre-upgrade checklists, troubleshooting tips, and a comparison