- Kubernetes Operator User's Guide
- Use Helm in Your TimesTen Kubernetes Operator Environment
- Roll Back an Upgrade
- Roll back a Non-Replicated TimesTen Upgrade
Roll back a Non-Replicated TimesTen Upgrade
You can use Helm to roll back an upgrade of a non-replicated TimesTenClassic object. This reverts the non-replicated TimesTenClassic object and its associated TimesTen databases to the downgraded release.
- Before the rollback, do the following:
- Confirm the non-replicated TimesTenClassic object exists in your namespace.
kubectl get ttc
The output is similar to the following:NAME STATE ACTIVE AGE norepsamplehelm AllReplicasReady N/A 20h repsamplehelm Normal repsamplehelm-0 23h
The
norepsamplehelm
TimesTenClassic object exists and is in theAllReplicasReady
state. - Verify the image and the value of
rollingUpdatePartition
.kubectl get ttc norepsamplehelm -o yaml | grep 'image\|rollingUpdatePartition'
The output is similar to the following:image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 ... rollingUpdatePartition: 0 ...
The current value for
rollingUpdatePartition
is0
. However, the value used for the downgrade is the original value ofrollingUpdatePartition
. In the example, the original value is2
. If you roll back to the original chart release in which therollingUpdatePartition
value is2
, Kubernetes only downgrades the-2
Pod. An upcoming step illustrates this.
- Confirm the non-replicated TimesTenClassic object exists in your namespace.
- Review the revision history.
helm history norepsamplehelm
The output is similar to the following:REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION 1 Sun Aug 4 17:42:47 2024 superseded ttclassic-2211270.1.0 22.1.1.27.0 Install complete 2 Mon Aug 5 04:22:15 2024 superseded ttclassic-2211280.1.0 22.1.1.28.0 Upgrade complete 3 Mon Aug 5 04:56:32 2024 deployed ttclassic-2211280.1.0 22.1.1.28.0 Upgrade complete
Revision
3
of thenorepsamplehelm
chart is running release22.1.1.28.0
. Revision1
is running release22.1.1.27.0
. - Roll back to revision
1
.helm rollback norepsamplehelm 1
The output is the following:
Rollback was a success! Happy Helming!
- Monitor the progress.
kubectl get ttc norepsamplehelm
The output is similar to the following:
NAME STATE ACTIVE AGE norepsamplehelm SomeReplicasReady N/A 20h
The object is in the
SomeReplicasReady
state.Wait a few minutes. Then, monitor again.
kubectl get ttc norepsamplehelm
The output is similar to the following:
NAME STATE ACTIVE AGE norepsamplehelm AllReplicasReady N/A 20h
The object is in the
AllReplicasReady
state. All replicas are ready and available. TimesTen databases are up and running and functioning properly. - Check the
rollingUpdatePartition
value and the image for the Pods.- Check the value of
rollingUpdatePartition
.kubectl get ttc norepsamplehelm -o yaml | grep rollingUpdatePartition
The output is similar to the following:
rollingUpdatePartition: 2
As part of the downgrade process, the value of
rollingUpdatePartition
changes to its original value of2
. - Check the
norepsamplehelm-2
Pod.kubectl describe pod norepsamplehelm-2 | grep Image
The output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0
The containers in the Pod are running the downgraded image. Due to the
rollingUpdatePartition
value of2
, Kubernetes updated this Pod with the downgraded image. This is correct behavior. - Check the
norepsamplehelm-1
Pod.kubectl describe pod norepsamplehelm-1 | grep Image
The output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0
The containers in the Pod are not running the downgraded image. Due to the
rollingUpdatePartition
value of2
, Kubernetes does not update this Pod with the downgraded image. This is correct behavior. - Check the
norepsamplehelm-0
Pod.kubectl describe pod norepsamplehelm-0 | grep Image
The output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0
The containers in the Pod are not running the downgraded image. Due to the
rollingUpdatePartition
value of2
, Kubernetes does not updated this Pod with the downgraded image. This is correct behavior.
After you confirm the downgrade is working, you can downgrade the remaining Pods. - Check the value of
- Create a new YAML file and in it specify the
rollingUpdatePartition
variable and set the value to0
.vi customyaml/changerollingupdate0.yaml rollingUpdatePartition: 0
- Change the
rollingUpdatePartition
value.Note:
We recommend the following syntax. This ensures existing customizations are preserved.helm get values norepsamplehelm --all > prev-values-noreprolling0.yaml && helm upgrade -f prev-values-noreprolling0.yaml -f customyaml/changerollingupdate0.yaml norepsamplehelm ./ttclassic
The output is similar to the following:Release "norepsamplehelm" has been upgraded. Happy Helming! NAME: norepsamplehelm LAST DEPLOYED: Mon Aug 5 15:09:42 2024 NAMESPACE: default STATUS: deployed REVISION: 5 NOTES: Version 2211270.1.0 of the ttclassic chart has been installed. This release is named "norepsamplehelm". To learn more about the release, try: $ helm status norepsamplehelm $ helm get all norepsamplehelm $ helm history norepsamplehelm To rollback to a previous version of the chart, run: $ helm rollback norepsamplehelm <REVISION> - run 'helm history norepsamplehelm' for a list of revisions.
Kubernetes automatically begins to terminate Pods and replace them with new ones. These new Pods run the downgraded image. Since
rollingUpdatePartition
is now0
, you should expect to see thenorepsamplehelm-1
andnorepsamplehelm-0
Pods updated with the downgraded image. - Monitor the progress.
- TimesTenClassic object:
kubectl get ttc norepsamplehelm
The output is similar to the following
NAME STATE ACTIVE AGE norepsamplehelm SomeReplicasReady N/A 21h
- Pods:
kubectl get pods
The output is similar to the following:
NAME READY STATUS RESTARTS AGE norepsamplehelm-0 3/3 Running 0 10h norepsamplehelm-1 0/3 Init:0/1 0 73s norepsamplehelm-2 3/3 Running 0 34m
Kubernetes replaces the
norepsamplehelm-1
Pod first. Wait a few minutes. Then monitor again.kubectl get pods
The output is similar to the following:
NAME READY STATUS RESTARTS AGE norepsamplehelm-0 3/3 Running 0 7m24s norepsamplehelm-1 3/3 Running 0 9m49s norepsamplehelm-2 3/3 Running 0 42m
Kubernetes replaced the
norepsamplehelm-1
and thenorepsamplehelm-0
Pods. All Pods are running.
- TimesTenClassic object:
- Confirm the Pods are running the downgraded container image.
Pod
norepsamplehelm-1:
kubectl describe pod norepsamplehelm-1 | grep Image
The output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0
Pod
norepsamplehelm-0
:kubectl describe pod norepsamplehelm-0 | grep Image
The output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0
The Pods are running the new image.
- Confirm the value of
rollingUpdatePartition
.kubectl get ttc norepsamplehelm -o yaml | grep rollingUpdatePartition
The output is similar to the following:
rollingUpdatePartition: 0
- Confirm the state of the TimesTenClassic object.
kubectl get ttc norepsamplehelm
The output is similar to the following:
NAME STATE ACTIVE AGE norepsamplehelm AllReplicasReady N/A 21h
- Check the history.
helm history norepsamplehelm
The output is similar to the following:
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION 1 Sun Aug 4 17:42:47 2024 superseded ttclassic-2211270.1.0 22.1.1.27.0 Install complete 2 Mon Aug 5 04:22:15 2024 superseded ttclassic-2211280.1.0 22.1.1.28.0 Upgrade complete 3 Mon Aug 5 04:56:32 2024 superseded ttclassic-2211280.1.0 22.1.1.28.0 Upgrade complete 4 Mon Aug 5 14:36:43 2024 superseded ttclassic-2211270.1.0 22.1.1.27.0 Rollback to 1 5 Mon Aug 5 15:09:42 2024 deployed ttclassic-2211270.1.0 22.1.1.27.0 Upgrade complete
Revision
5
is running the2211270.1.0
chart. - Confirm the
norepsamplehelm
release is downgraded.helm list
The output is similar to the following:NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION norepsamplehelm default 5 2024-08-05 15:09:42.959017268 +0000 UTC deployed ttclassic-2211270.1.0 22.1.1.27.0
The
norepsamplehelm
chart release is downgraded.
AllReplicasReady
state. All replicas are ready and available. Pods are running the downgraded TimesTen container image. TimesTen databases are upgraded and fully operational.