Lab 3
Let's say you deployed different release versions of your application (i.e., you upgraded the running application). How do you keep track of the versions and how can you do a rollback?
Scenario 1: Revision management using Kubernetes
In this part of the lab, we should illustrate revision management of guestbook
by using Kubernetes directly, but we can't. This is because Kubernetes does not provide any support for revision management. The onus is on you to manage your systems and any updates or changes you make. However, we can use Helm to conduct revision management.
Scenario 2: Revision management using Helm
In this part of the lab, we illustrate revision management on the deployed application guestbook-demo
by using Helm.
With Helm, every time an install, upgrade, or rollback happens, the revision number is incremented by 1. The first revision number is always 1. Helm persists release metadata in Secrets (default) or ConfigMaps, stored in the Kubernetes cluster. Every time your release changes, it appends that to the existing data. This provides Helm with the capability to rollback to a previous release.
Let's see how this works in practice.
Roll back to the previous revision:
In this rollback, Helm checks the changes that occured when upgrading from the revision 1 to revision 2. This information enables it to makes the calls to the Kubernetes API server, to update the deployed application as per the initial deployment - in other words with Redis slaves and using a load balancer.
Rollback with this command:
Check the history again:
You should see output similar to the following:
Check the rollback, using:
You can see from the output that the app service is the service type of
LoadBalancer
again and the Redis master/slave deployment has returned. This shows a complete rollback from the upgrade in Lab 2
Conclusion
From this lab, we can say that Helm does revision management well and Kubernetes does not have the capability built in! You might be wondering why we need helm rollback
when you could just re-run the helm upgrade
from a previous version. And that's a good question. Technically, you should end up with the same resources (with same parameters) deployed. However, the advantage of using helm rollback
is that helm manages (ie. remembers) all of the variations/parameters of the previous helm install\upgrade
for you. Doing the rollback via a helm upgrade
requires you (and your entire team) to manually track how the command was previously executed. That's not only tedious but very error prone. It is much easier, safer and reliable to let Helm manage all of that for you and all you need to do it tell it which previous version to go back to, and it does the rest.
Lab 4 awaits.
Last updated