0
0
Kubernetesdevops~5 mins

Why Helm simplifies deployments in Kubernetes - Why It Works

Choose your learning style9 modes available
Introduction
Deploying applications on Kubernetes can be complex because you must manage many configuration files. Helm helps by packaging these files into a single chart, making deployment easier and repeatable.
When you want to deploy an application with multiple Kubernetes resources like deployments, services, and config maps together.
When you need to update your application frequently and want to manage versions easily.
When you want to share your application setup with others in a simple package.
When you want to customize deployments for different environments without rewriting configuration files.
When you want to roll back to a previous version of your application quickly if something goes wrong.
Config File - Chart.yaml
Chart.yaml
apiVersion: v2
name: my-app
description: A simple Helm chart for deploying my-app
version: 0.1.0
appVersion: "1.0"

apiVersion: Specifies the Helm chart version format.

name: The name of your application chart.

description: A short explanation of what this chart does.

version: The version of the chart itself, used for managing updates.

appVersion: The version of the application being deployed.

Commands
This command creates a new Helm chart named 'my-app' with a basic folder structure and example files to start your deployment.
Terminal
helm create my-app
Expected OutputExpected
Creating my-app Created directory my-app Created Chart.yaml Created values.yaml Created templates/deployment.yaml Created templates/service.yaml Created templates/_helpers.tpl Created .helmignore
This command installs the 'my-app' chart into your Kubernetes cluster, deploying all resources defined in the chart.
Terminal
helm install my-app ./my-app
Expected OutputExpected
NAME: my-app LAST DEPLOYED: Fri Apr 26 12:00:00 2024 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: 1. Get the application URL by running these commands: export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=my-app,app.kubernetes.io/instance=my-app" -o jsonpath='{.items[0].metadata.name}') echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:80
This command lists all Helm releases installed in your Kubernetes cluster, showing their status and version.
Terminal
helm list
Expected OutputExpected
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION my-app default 1 2024-04-26 12:00:00.000000 deployed my-app-0.1.0 1.0
This command upgrades the existing 'my-app' release with any changes made in the chart files, applying updates without downtime.
Terminal
helm upgrade my-app ./my-app
Expected OutputExpected
Release "my-app" has been upgraded. Happy Helming! NAME: my-app LAST DEPLOYED: Fri Apr 26 12:05:00 2024 NAMESPACE: default STATUS: deployed REVISION: 2 NOTES: 1. Get the application URL by running these commands: export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=my-app,app.kubernetes.io/instance=my-app" -o jsonpath='{.items[0].metadata.name}') echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:80
This command rolls back the 'my-app' release to revision 1, undoing the last upgrade if it caused problems.
Terminal
helm rollback my-app 1
Expected OutputExpected
Rollback was a success! Happy Helming! NAME: my-app LAST DEPLOYED: Fri Apr 26 12:10:00 2024 NAMESPACE: default STATUS: deployed REVISION: 3 NOTES: 1. Get the application URL by running these commands: export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=my-app,app.kubernetes.io/instance=my-app" -o jsonpath='{.items[0].metadata.name}') echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:80
Key Concept

If you remember nothing else from this pattern, remember: Helm packages all Kubernetes resources into one chart to make deploying, updating, and rolling back apps simple and repeatable.

Common Mistakes
Trying to deploy Kubernetes resources manually without using Helm charts.
This causes repetitive work and makes updates or rollbacks difficult and error-prone.
Use Helm charts to bundle resources and manage deployments with simple commands.
Not updating the chart version in Chart.yaml before upgrading the release.
Helm may not recognize changes properly, causing upgrade failures or confusion.
Always increment the chart version in Chart.yaml when making changes before running helm upgrade.
Ignoring the output notes after helm install or upgrade commands.
You might miss important instructions like how to access your application or check its status.
Read the notes carefully to understand how to interact with your deployed app.
Summary
Use 'helm create' to generate a new chart with all necessary files for deployment.
Deploy your app with 'helm install' to apply all Kubernetes resources at once.
Manage updates easily with 'helm upgrade' and undo changes with 'helm rollback'.