- Kubernetes Operator User's Guide
- Use Helm in Your TimesTen Kubernetes Operator Environment
- Upgrade
- Upgrade Non-Replicated TimesTen Databases
Upgrade Non-Replicated TimesTen Databases
Let's perform an upgrade of a non-replicated TimesTenClassic object consisting of three independent TimesTen databases.
-
Create a YAML file. In this file, you specify the container image that contains the new release of TimesTen.
-
Use the
helm
values
command for the upgrade. The example shows you how to do this.
In addition, the example shows you how to change the value for the rollingUpdatePartition
variable.
- On your development host, change to the
helm
directory that contains the new Helm charts.cd new_kube_files/helm
- Create a YAML file and in it specify the name of the TimesTen image you want to use for the upgrade.
vi customyaml/upgradenonreplicated.yaml image: repository: container-registry.oracle.com/timesten/timesten tag: "22.1.1.28.0"
- Before the upgrade, 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 10h repsamplehelm Normal repsamplehelm-1 13h
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.27.0 ... rollingUpdatePartition: 2 ...
The value for
rollingUpdatePartition
is2
, indicating that Kubernetes upgrades Pods with an ordinal value greater than or equal to2
. For thenorepsamplehelm
object, since the value ofreplicas
is3
, there are three Pods namednorepsamplehelm-0
,norepsamplehelm-1
, andnorepsamplehelm-2
. Therefore, Kubernetes only upgrades thenorepsamplehelm-2
Pod.
- Confirm the non-replicated TimesTenClassic object exists in your namespace.
- Confirm the
ttclassic
chart release.helm list
The output is similar to the following:NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION norepsamplehelm default 1 2024-08-04 17:42:47.180635098 +0000 UTC deployed ttclassic-2211270.1.0 22.1.1.27.0
- Upgrade to the new release. Use the
ttclassic
chart from the new release and use the customized YAML file that references the new image.Note:
We recommend the following syntax. This ensures existing customizations are preserved.helm get values norepsamplehelm --all > prev-values-norepttc.yaml
helm upgrade -f prev-values-norepttc.yaml -f customyaml/upgradenonreplicated.yaml norepsamplehelm ./ttclassic
Let's look at thishelm
upgrade
command:-
The
get values norepsamplehelm
Helm command retrieves the values for the current release, including existing customizations. The result of this command is piped into theprev-values-norepttc.yaml
file. You can choose any name for this file. -
The
helm
upgrade
command uses theprev-values-norepttc.yaml
file with the customizedupgradenonreplicated.yaml
file to do the upgrade.
Let's look at the output from the
helm
upgrade
command.Release "norepsamplehelm" has been upgraded. Happy Helming! NAME: norepsamplehelm LAST DEPLOYED: Mon Aug 5 04:22:15 2024 NAMESPACE: default STATUS: deployed REVISION: 2 NOTES: Version 2211280.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.
Note the following:-
The
norepsamplehelm
chart release is upgraded. The release revision is2
. -
The status of the release is
deployed
. -
The
ttclassic
chart version is2211280.1.0
corresponding to TimesTen release22.1.1.28.0
.
-
- Monitor the progress.
kubectl get ttc norepsamplehelm
The output is similar to the following:
NAME STATE ACTIVE AGE norepsamplehelm SomeReplicasReady N/A 10h
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 10h
The object is in the
AllReplicasReady
state. All replicas are ready and available. TimesTen databases are up and running and functioning properly. - Check the image that the
norepsamplehelm-2
Pod is running.kubectl describe pod norepsamplehelm-2 | 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 running the new container image.
- Check the image for the
norepsamplehelm-1
andnorepsamplehelm-0
Pods.- 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.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 not running the new image. Due to the
rollingUpdatePartition
value of2
, Kubernetes does not upgrade this Pod with the new 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.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 not running the new image. Due to the
rollingUpdatePartition
value of2
, Kubernetes does not upgrade this Pod with the new image. This is correct behavior.
After you confirm the upgrade is working, you can upgrade the remaining Pods. - Check the
- Create a YAML file and in it specify the
rollingUpdatePartition
variable and set the value to0
.vi customyaml/changerollingupdate.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-noreprolling.yaml && helm upgrade -f prev-values-noreprolling.yaml -f customyaml/changerollingupdate.yaml norepsamplehelm ./ttclassic
The output is similar to the following:Release "norepsamplehelm" has been upgraded. Happy Helming! NAME: norepsamplehelm LAST DEPLOYED: Mon Aug 5 04:56:32 2024 NAMESPACE: default STATUS: deployed REVISION: 3 NOTES: Version 2211280.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 new image. Since
rollingUpdatePartition
is now0
, you should expect to see thenorepsamplehelm-1
andnorepsamplehelm-0
Pods upgraded with the new 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 11h
- Pods:
kubectl get pods
The output is similar to the following:
NAME READY STATUS RESTARTS AGE norepsamplehelm-0 3/3 Running 0 11h norepsamplehelm-1 0/3 Init:0/1 0 31s 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 3m14s norepsamplehelm-1 3/3 Running 0 6m8s norepsamplehelm-2 3/3 Running 0 40m
Kubernetes replaced the
norepsamplehelm-1
and thenorepsamplehelm-0
Pods. All Pods are running.
- TimesTenClassic object:
- Confirm the Pods are running the new 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.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
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.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 Pods are running the new image.
- 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 11h
Congratulations! You successfully performed an automated upgrade for a non-replicated TimesTenClassic object. All replicas are ready and available. Pods are running the new TimesTen container image. TimesTen databases are upgraded and fully operational.