🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Helm Lab – 3: Deploying & Retrieving & Upgrading & Rolling Back a Helm

Deploying a Chart to Kubernetes Cluster

# Confirm Helm version
$ helm version
# Add a helm repository to use the charts in the following demos
# using this custom repository as the charts in the stable repository have been deprecated.
$ helm repo add stable https://charts.helm.sh/stable
# Search for a chart
$ helm search repo stable/mysql
# confirm current context
$ kubectl config current-context
# test connection to cluster
$ kubectl get nodes
# list helm repositories
$ helm repo list
# search repository for a mysql chart
$ helm search repo stable/mysql
# show chart definition
$ helm show chart stable/mysql
# show chart README
$ helm show readme stable/mysql
# pipe README to file
$ helm show readme stable/mysql > C:\Temp\README.txt
# show chart values
$ helm show values stable/mysql > C:\Temp\values.txt
# test deployment of chart
$ helm install mysql stable/mysql --dry-run --debug
# deploy chart
$ helm install mysql stable/mysql
# confirm deployment
$ helm list
view raw deploy.sh hosted with ❤ by GitHub

Retrieving information about a Release

# view deployments
$ helm list
# view status of release
$ helm status mysql
# get release manifests
$ helm get manifest mysql > C:\Temp\manifests.txt
# get release values - no user values were supplied so file will be blank
$ helm get values mysql > C:\Temp\values.txt
# get release notes
$ helm get notes mysql > C:\Temp\notes.txt
# get all from release
$ helm get all mysql > C:\Temp\all.txt
# view kubernetes objects
$ kubectl get all
# view release history
$ helm history mysql
# uninstall a release
$ helm uninstall mysql --keep-history
# confirm
$ helm list
# confirm with --all flag
$ helm list --all
# delete release
$ helm delete mysql
# confirm with --all flag
$ helm list --all
view raw helm.sh hosted with ❤ by GitHub

Upgrading a Release

# search the repository for a chart
$ helm search repo stable/mysql
# search the stable repository for a chart and retrieve the different versions (2 in the repo)
$ helm search repo stable/mysql --versions
# install a specific version of the chart
$ helm install mysql stable/mysql --version 1.6.3
# confirm release deployed
$ helm list
# view kubernetes objects
$ kubectl get all
# upgrade the release
$ helm upgrade mysql stable/mysql --version 1.6.4
# confirm release upgraded
$ helm list
# view history of release
$ helm history mysql
# view kubernetes objects
$ kubectl get all
view raw helm.sh hosted with ❤ by GitHub

Rolling back a Release

# view release
helm list
# view release history
helm history mysql
# view kubernetes objects
kubectl get all
# view replicasets
kubectl get replicasets
# rollback release
helm rollback mysql 1
# view release history
helm history mysql
# view kubernetes objects
kubectl get all
# view replicasets
kubectl get replicasets
# view secrets
kubectl get secrets
###################################################################################################
# Rolling back without the old replicaset
###################################################################################################
# clean up previous release
helm delete mysql
# deploy specific version of chart
helm install mysql stable/mysql --version 1.6.3
# upgrade release
helm upgrade mysql stable/mysql --version 1.6.4
# confirm history
helm history mysql
# view kubernetes objects
kubectl get all
# view replicasets
kubectl get replicaset
# delete old replicaset - replace NAME with the old replicaset name
kubectl delete replicaset NAME
# confirm deletion
kubectl get replicaset
# try a rollback with kubectl - will fail as we have deleted the old replicaset
kubectl rollout undo deployment/mysql
# but we still have the history of the release in Helm
helm history mysql
# rollback with helm
helm rollback mysql 1
# confirm status of release
helm list
# confirm rollback
helm history mysql
# view replicaset
kubectl get replicaset
# the old replicaset is back!
# this is due to the release history being stored as secrets in the k8s cluster
kubectl get secrets
# let's a look at one of those secrets
kubectl get secret sh.helm.release.v1.mysql.v1 -o yaml
$ kubectl get secret sh.helm.release.v1.mysql.v1 -o jsonpath="{ .data.release }" | base64 -d | base64 -d | gunzip -c | jq '.chart.templates[].data' | tr -d '"' | base64 -d
# the secret is encoded. For further information on decoding these secrets, see here: -
# https://dbafromthecold.com/2020/08/10/decoding-helm-secrets/
view raw helm.sh hosted with ❤ by GitHub
Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x