0
0
Kubernetesdevops~5 mins

Helm charts concept in Kubernetes - Commands & Configuration

Choose your learning style9 modes available
Introduction
Managing Kubernetes applications can be complex because they require many files and settings. Helm charts help by packaging all these files into one easy-to-use bundle, making it simple to install, update, or remove applications on Kubernetes.
When you want to deploy a web application with multiple Kubernetes resources like deployments, services, and config maps all at once.
When you need to share your Kubernetes application setup with others in a reusable and version-controlled way.
When you want to upgrade your application smoothly without manually changing each Kubernetes file.
When you want to roll back to a previous version of your application easily if something goes wrong.
When you want to manage complex applications with many configuration options in a simple way.
Config File - Chart.yaml
Chart.yaml
apiVersion: v2
name: my-app
description: A simple Helm chart for Kubernetes
version: 0.1.0
appVersion: 1.0.0

apiVersion: Helm chart version format.

name: The chart name.

description: A short explanation of the chart.

version: The chart package version.

appVersion: The version of the app this chart deploys.

Commands
This command creates a new Helm chart named 'my-app' with a basic folder structure and example files to start with.
Terminal
helm create my-app
Expected OutputExpected
Creating new chart 'my-app'
This installs the 'my-app' chart into your Kubernetes cluster, creating all the resources defined in the chart.
Terminal
helm install my-app ./my-app
Expected OutputExpected
NAME: my-app LAST DEPLOYED: Sat Jun 10 12:00:00 2023 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 shows all Helm releases installed in the current Kubernetes cluster and namespace.
Terminal
helm list
Expected OutputExpected
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION my-app default 1 2023-06-10 12:00:00.000000 deployed my-app-0.1.0 1.0.0
This removes the 'my-app' release and deletes all Kubernetes resources created by it.
Terminal
helm uninstall my-app
Expected OutputExpected
release "my-app" uninstalled
Key Concept

If you remember nothing else from this pattern, remember: Helm charts package Kubernetes resources into one reusable bundle to simplify app deployment and management.

Common Mistakes
Trying to install a Helm chart without creating or downloading it first.
Helm needs the chart files locally or from a repository to install; without them, it cannot deploy anything.
Run 'helm create my-app' to create a chart or 'helm repo add' and 'helm repo update' to get charts from a repository before installing.
Not checking the status of the Helm release after installation.
You might think the app is running when it failed to deploy properly, causing confusion and wasted time.
Use 'helm list' or 'helm status my-app' to verify the release status and troubleshoot if needed.
Manually editing Kubernetes resources created by Helm instead of updating the chart.
Helm manages resources based on the chart; manual changes can be overwritten or cause conflicts during upgrades.
Update the Helm chart templates or values and use 'helm upgrade' to apply changes cleanly.
Summary
Use 'helm create' to generate a new chart with a ready folder structure.
Install the chart with 'helm install' to deploy your app and its resources to Kubernetes.
Check installed releases with 'helm list' to see what is running.
Remove apps cleanly with 'helm uninstall' to delete all related resources.