Helm Charts: Simplifying Kubernetes Management
Kundan Antyakula??
Devops Engineer - Data & Infrastructure Specialist | AWS Certified (2x) | GitHub Certified (1x) | Kubernetes & Containerization | CI/CD & Infrastructure Automation | Driving Secure Data & Scalable DevOps Solutions
Meta Description: Discover how Helm Charts can streamline Kubernetes management by automating deployment, scaling, and updates for your applications.
Introduction
Managing Kubernetes clusters can be complex, but Helm Charts simplify this process, allowing developers to deploy, manage, and scale applications effortlessly. Helm Charts provide a powerful, user-friendly approach to Kubernetes management, automating deployment and configuration, and making it easier to maintain and update applications.
What is a Helm Chart?
A Docker container running on a development machine is initially designed to handle single-user interactions. However, when scaled with Kubernetes, it can efficiently manage millions of requests. Kubernetes orchestrates the Docker container, enabling features like auto-scaling, self-healing, and load balancing, which alleviate concerns about handling high request volumes.
An abstract framework, sitting atop the Kubernetes cluster, simplifies Kubernetes cluster management significantly. Using Helm charts provides a streamlined approach, allowing minimal commands to interface with the Kubernetes cluster efficiently.
Why We Need Kubernetes
Kubernetes is essential for several reasons:
How Helm Charts Help Manage Kubernetes
Helm Charts streamline Kubernetes management by allowing you to define, install, and upgrade even the most complex Kubernetes applications. Here are the differences between using kubectl commands and Helm commands:
Using kubectl commands
kubectl apply -f deployment.yml
kubectl apply -f service.yml
kubectl apply -f ingress.yml
kubectl delete -f deployment.yml
kubectl delete -f service.yml
kubectl delete -f ingress.yml
Using Helm commands
helm install my-app ./my-chart
helm uninstall my-app
Helm Charts bundle Kubernetes resources into a single package that can be managed more easily.
How to Install Helm Chart
Step-by-Step Guide
Check Kubernetes Resources
kubectl get all --all-namespaces
Install Helm
curl -L https://git.io/get_helm.sh | bash -s -- --
领英推荐
Create Your First Helm Chart
helm create helloworld
This command creates a directory called helloworld. Verify it with:
ls -lart | grep helloworld
Verify Directory Structure
tree helloworld
The structure should look like this:
helloworld
├── Chart.yaml
├── charts
├── templates
│?? ├── NOTES.txt
│?? ├── _helpers.tpl
│?? ├── deployment.yaml
│?? ├── hpa.yaml
│?? ├── ingress.yaml
│?? ├── service.yaml
│?? ├── serviceaccount.yaml
│?? └── tests
│?? └── test-connection.yaml
└── values.yaml
Update Service Type
Before running your Helm Chart, update the service.type in values.yaml from ClusterIP to NodePort to access the service outside of the Kubernetes cluster.
cd helloworld
vi values.yaml
Install the Helm Chart
helm install customhelm helloworld
Output:
NAME: customhelm
LAST DEPLOYED: Thu Jul 11 16:55:16 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services customhelm-helloworld)
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
echo https://$NODE_IP:$NODE_PORT
Verify Helm Installation
helm list -a
Output:
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
customhelm default 1 2024-07-11 16:55:16.134363 +0530 IST deployed helloworld-0.1.0 1.16.0
Get Kubernetes Service Details and Port
kubectl get service
Output
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
customhelm-helloworld NodePort 10.105.3.203 <none> 80:30480/TCP 2m13s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 64m