HELM :
Helm is a Kubernetes package manager that simplifies the deployment of
applications. It allows you to group multiple YAML files, such as backend and
frontend configurations, under a single roof (Helm) and deploy them as a
package.
For example,
if you want to deploy an application like Paytm, which contains multiple
services, traditionally you would need to write at least two manifest files
(Deployment & Service) for each service. This can result in multiple YAML files,
creating confusion and making the process messy.
By implementing Helm, you can manage and deploy the entire application as a
single entity, reducing complexity and making deployments more efficient.
Key Concepts of Helm
1. Charts:
o A Helm chart is a collection of pre-configured Kubernetes resources that
define a related set of services.
o Charts include deployment configurations, service definitions, ingress rules,
and more.
o Think of a chart as a "package" that encapsulates everything needed to run a
specific application.
2. Templates:
o Helm uses Go templating to dynamically generate Kubernetes manifest files
from chart templates.
o This allows parameterization and customization of resources based on user-
defined values or inputs.
o The templating mechanism makes configurations reusable and flexible.
3. Values:
o Values are customizable parameters injected into chart templates during
deployment.
o Default values are defined in a [Link] file, which can be overridden
when installing or upgrading a chart.
o This flexibility enables different configurations for various environments or
use cases.
4. Repositories:
o Helm repositories are collections of packaged charts available for users to
install.
o The Helm CLI can search, fetch, and install charts from these repositories.
o Users can also create private repositories to store custom charts.
Advantages of Helm
• Saves time by automating deployment.
• Simplifies application deployment processes.
• Enhances scalability.
• Supports easy rollbacks at any time.
• Increases the speed of deployment.
Installing Helm
• To install Helm, follow these steps:
• curl -fsSL -o get_helm.sh
[Link]
• chmod 700 get_helm.sh
• ./get_helm.sh
• helm version
Common Helm Commands
1. List all Helm repositories:
• helm repo list
2. Add a new Helm repository:
• helm repo add <repo_name> <repo_url>
# Example:helm repo add myhelm [Link]
3. Remove a Helm repository:
• helm repo remove <repo_name>
Deploy a Sample Nginx Page Using Helm:
Step 1: Create a Helm Chart
Run the following command to create a Helm chart:
(helm create swiggy)
• This will create a folder named swiggy.
• Navigate into the swigyy folder:
(cd devops)
Step 2: Update [Link]
• Open the [Link] file inside the swiggy folder.
• Locate line 43 (or search for [Link]) and change the service type from ClusterIP
to NodePort:
service:
type: NodePort
Step 3: Install the Helm Chart
Run the following command to install the Helm chart:
helm install myapp-v1 .
• Here:
o Myapp-v1 is the release name.
o The . (dot) represents the current directory where the [Link] file is
located.
• Once installed, you will see that pods, deployments, and services are created
automatically.
Step 4: Access the Nginx Page
• Use the slave node IP and the NodePort (from the service) to access the Nginx
page:
[Link]
Step 5: Scale Up the Replicas
• Open the [Link] file again and update the replica count from 1 to 4 under the
replicaCount field:
(replicaCount: 4)
• To apply this change, upgrade the Helm release:
(helm upgrade myapp-v1 .)
• Verify the pod count:
(kubectl get pods)
The pod count will increase from 1 to 4.
Step 6: View Helm Release Information
• To get a list of Helm releases, run:
(helm list) or (helm ls)
• After scaling, the revision (version) of the release will increase from 1 to 2.
Step 7: Rollback to a Previous Revision
• To rollback to the first revision (version 1), use:
(helm rollback myapp-v1 1)
• Once rolled back, the pod count will scale down from 4 to 1 again.
Verify the pod count after rollback: (kubectl get pods)