HELM
1. Install helm using the official website of Helm in your K8s cluster.
2. Validate the Helm Installation
3. Like we have dockerhub for docker , similarly we have https://artifacthub.io for Helm.
4. We will install metric-server using Helm.
5. Repo added locally
6. Now, will install the chart using the below hem install command.
helm upgrade --install metrics-server metrics-server/metrics-server -n kube-system
7. HPA metrics-server working as expected.
8. Now, will increase the replicas using --set replicas
helm upgrade --install metrics-server metrics-server/metrics-server -n kube-system --set replicas=2
9. We can the revision after the increasing the replicas of metrics-server pod.
10. In case something is not working we can rollback to the previous version.
helm rollback metrics-server -n kube-system
11. Revisions are saved in secrets objects of Kubernetes cluster.
12. Uninstalling the chart metrics-server.
helm uninstall metrics-server -n kube-system
Creating chart for our applications
1. Create Helm chart using below command for the application.
helm create nginxchart
sudo yum install tree -y → (if tree command not available – its optional)
2. Now, we need to modify the values.yaml file according to our requirement.
3. Once the required changes are we can run the below to check the fine template.
helm template nginx nginxchart/
4. Once all the checks are done, we can install the chart.
helm install nginx nginxchart
5. I did a change in the service from ClusterIP changed to LoadBalancer.
export SERVICE_IP=$(kubectl get svc --namespace default nginxdeployment --template "{{ range (index
.status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
$ echo http://$SERVICE_IP:80
http://a148dc8e09bd44f78ba8b63ed4ccc6fd-840426712.ap-south-1.elb.amazonaws.com:80
6. To rollback to previous version we can use the below command.
Usage:
helm rollback <RELEASE> [REVISION] [flags]
In Revision 1 we had ClusterIp for the service instead of LoadBalancer
7. To uninstall the chart
Usage:
helm uninstall RELEASE_NAME [...] [flags]
Ex -helm uninstall nginx
8. To list the repo in helm
Usage: helm repo ls
9. To search repo
Usage:
helm search [command]
Available Commands:
hub search for charts in the Artifact Hub or your own hub instance
repo search repositories for a keyword in charts
10. To Render chart templates locally and display the output.
Usage:
helm template [NAME] [CHART] [flags]
11. Helm show values command
12. Integrating with Github for managing the Helm charts.
13. Helm lint & package command
a. Helm lint
This command takes a path to a chart and runs a series of tests to verify that the chart is well-formed.
If the linter encounters things that will cause the chart to fail installation, it will emit [ERROR] messages. If it
encounters issues that break with convention or recommendation, it will emit [WARNING] messages.
Usage:
helm lint PATH [flags]
b. helm package
This command packages a chart into a versioned chart archive file. If a path is given, this will look at that path
for a chart (which must contain a Chart.yaml file) and then package that directory.
Versioned chart archives are used by Helm package repositories.
Usage:
helm package [CHART_PATH] [...] [flags]
14. Clone the repo
15. Move the tgz file inside the HelmChartRepo
16. Run the below command
helm repo index HelmChartRepo --url https://msdeepak052.github.io/HelmChartRepo/
Note: Above URL(Repo) is GitHub Page Link Which We can get from Git Hub Pages of our repo.
17. Perform the below git command.
$ cd HelmChartRepo
$ git add .
$ git commit -a -m "Updated Chart Files"
$ git push origin
18. Add the repo to the helm
helm repo add HelmChartRepo https://msdeepak052.github.io/HelmChartRepo/
19. Once the helm charts are added in the repo we can install the k8s resources using helm install