# Master Kubernetes Helm-Charts

### Why do we need Helm-Charts ? While we having manifests files ?

Running single-single manifest files is soo boring and dealing with multiple files will be come hard.\
Example:\
kubectl apply -f deployment.yml\
kubectl apply -f configmap.yml\
kubectl apply -f secret.yml\
kubectl apply -f service.yml\
\
So can we keep all the manifest files in one folder and can trigger one simple command so that manifest file will get deployed ?\
\
This is what helm will do it for you

What is Helm ?

Helm is a package manager for the kubernetes applications and templatize the manifest files.

## Helm installation

sudo dnf install helm -y

## Helm Structure

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/2ca40ac4-5d60-46dd-95cb-169a171b7451.png align="center")

## Helm Commands

**<mark>helm install &lt;chart_name> &lt;directory></mark>**

\
This command will run the all manifests files in the templates folder of that particular chart .

**<mark>helm upgrade &lt;chart_name> -f values-dev.yaml --set service.targetport="80"</mark>**\
\
This command will run the all manifests files of particular chart and applies the values present in the values-dev.yaml file and sets the service.targetport to 80.\
We can change the values form the command line as well.\
\
\
**<mark>helm rollback &lt;chart_name></mark>**

Rollback to the previous revision\
\
**<mark>helm rollback &lt;chart_name> 1</mark>**

Rollback to the 1st version , if we want to rollback to specific version

**<mark>helm list</mark>**

Lists the all charts available

**<mark>helm uninstall &lt;chart_name></mark>**

You can delete the all the resources created in the cluster.

**<mark>helm history &lt;chart_name></mark>**

Gives the entire history of the chart and tells you currently which version was running in the cluster.

**<mark>helm status &lt;chart_name></mark>**

shows what all resources created for the last install / upgrade

## How Helm works ?

When you enter the helm install cart . then it will check which cluster is currently pointed too ?

Then it underhood converts to the manifest files and does the kubectly apply -f &lt;file_name>\
\
So if we having multiple clusters then how can we change to another ?\
\
**<mark>kubectl config get-contexts</mark>**

This command shows the currently which cluster was pointed too

```plaintext
CURRENT   NAME              CLUSTER
*         dev-cluster       dev-cluster
          test-cluster     test-cluster
          prod-cluster     prod-cluster
```

\
**<mark>kubectl config use-context test-cluster</mark>**

This command points to the dev-cluster

**<mark>helm install roboshop ./roboshop\
\--kube-context dev-cluster</mark>**

You can pass directly in the helm command as well\
\
**<mark>helm install roboshop ./roboshop\
\-f values-dev.yaml\
\--kube-context dev-cluster</mark>**\
\
You can pass the values-dev.yaml file also

![](https://cdn.hashnode.com/uploads/covers/66d950bc53b6fbeba2093f57/95be0b2b-9869-4112-9661-06f0b8428ec8.png align="center")

**Note:**

\
we should change the appVersion and the version in the chart.yml file while upgrading , because we will have the clear picture on the deployments when we do helm history &lt;chart_name>\
\
GitHub: <https://github.com/vija-web/Kubernetes-/tree/master/Helm_Charts>\
\
Thank you !\
Happy Helming !
