Perform an Automated Upgrade of a Non-Replicated TimesTenClassic Object
- Review the TimesTenClassic objects running in your namespace.
kubectl get ttcThe output is similar to the following:
NAME STATE ACTIVE AGE mannorepsample AllReplicasReady N/A 3h47m norepsample AllReplicasReady N/A 4d10s repsample Normal repsample-0 5d23hOne of the non-replicated TimesTenClassic objects is
norepsample. Its high level state isAllReplicasReady, indicating all replicas are ready and available. TimesTen databases are up and running and functioning properly. - Review the image upgrade strategy and rolling update partition values for the object.
kubectl get ttc norepsample -o yaml | grep 'imageUpgradeStrategy\|rollingUpdatePartition'The output is the following:
imageUpgradeStrategy: Auto rollingUpdatePartition: 2The image upgrade strategy is
Auto(also the default), indicating an automated upgrade strategy. The value forrollingUpdatePartitionis2, indicating that Kubernetes upgrades Pods with an ordinal value greater than or equal to2. For thenorepsampleobject, since the value ofreplicasis3, there are three Pods namednorepsample-0,norepsample-1, andnorepsample-2. Therefore, Kubernetes only upgrades thenorepsample-2Pod. Let's verify this by performing the upgrade. - On your development host, edit the TimesTenClassic object's
.spec.ttspec.imagedatum with the container image you want to use for the upgrade. This example usescontainer-registry.oracle.com/timesten/timesten:22.1.1.35.0.- Edit the file, replacing the
imagevalue withcontainer-registry.oracle.com/timesten/timesten:22.1.1.35.0.kubectl edit ttc norepsample # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: timesten.oracle.com/v4 kind: TimesTenClassic ... image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 ... - Save the file and exit from the editor.
- Edit the file, replacing the
- Confirm the StatefulSet contains the new image.
kubectl describe statefulset norepsample | grep ImageThe output is the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0When the TimesTen Operator detects that there is an update to the TimesTenClassic's
.spec.ttspec.imagedatum, it modifies the StatefulSet with the new image. Since this is an automated upgrade, the TimesTen Operator takes no further action, but Kubernetes does take action. Kubernetes automatically begins to terminate Pods and replace them with new ones. These new Pods run the new image. SincerollingUpdatePartitionis2, you should expect to see only thenorepsample-2Pod upgraded with the new image. - Monitor the progress.
kubectl get ttc norepsampleThe output is similar to the following:
NAME STATE ACTIVE AGE norepsample SomeReplicasReady N/A 16mThe object is in the
SomeReplicasReadystate.Wait a few minutes. Then, monitor again.
kubectl get ttc norepsampleThe output is similar to the following:
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 19mThe object is in the
AllReplicasReadystate. All replicas are ready and available. TimesTen databases are up and running and functioning properly. - Check the image that the
norepsample-2Pod is running.kubectl describe pod norepsample-2 | grep ImageThe output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0The containers in the Pod are running the new container image.
- Check the image for the
norepsample-1andnorepsample-0Pods.- Check the
norepsample-1Pod.kubectl describe pod norepsample-1 | grep ImageThe output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0The containers in the Pod are not running the new image. Due to the
rollingUpdatePartitionvalue of2, Kubernetes does not upgrade this Pod with the new image. This is correct behavior. - Check the
norepsample-0Pod.kubectl describe pod norepsample-0 | grep ImageThe output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0The containers in the Pod are not running the new image. Due to the
rollingUpdatePartitionvalue 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
- Edit the TimesTenClassic object's
.spec.ttspec.rollingUpdatePartitiondatum and change the value from2to0.- Edit the file, replacing the
rollingUpdatePartitionvalue with2.kubectl edit ttc norepsample # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: timesten.oracle.com/v4 kind: TimesTenClassic ... rollingUpdatePartition: 0 ... - Save the file and exit from the editor.
Kubernetes automatically begins to terminate Pods and replace them with new ones. These new Pods run the new image. Since
rollingUpdatePartitionis now0, you should expect to see thenorepsample-1andnorepsample-0Pods upgraded with the new image. - Edit the file, replacing the
- Monitor the progress.
- TimesTenClassic object:
kubectl get ttc norepsampleThe output is similar to the following
NAME STATE ACTIVE AGE norepsample SomeReplicasReady N/A 51m - Pods:
kubectl get podsThe output is similar to the following:
NAME READY STATUS RESTARTS AGE ... norepsample-0 3/3 Running 0 53m norepsample-1 0/3 Init:0/1 0 106s norepsample-2 3/3 Running 0 36mKubernetes replaces the
norepsample-1Pod first. Wait a few minutes. Then monitor again.kubectl get podsThe output is similar to the following:
NAME READY STATUS RESTARTS AGE ... norepsample-0 0/3 Init:0/1 0 46s norepsample-1 3/3 Running 0 3m41s norepsample-2 3/3 Running 0 38mKubernetes replaced the
norepsample-1Pod and is in the process of replacing thenorepsample-0Pod.Check again.
kubectl get podsThe output is similar to the following:
NAME READY STATUS RESTARTS AGE ... norepsample-0 3/3 Running 0 5m59s norepsample-1 3/3 Running 0 8m54s norepsample-2 3/3 Running 0 43mAll Pods are running.
- TimesTenClassic object:
- Confirm the Pods are running the new container image.
Pod
norepsample-1:kubectl describe pod norepsample-1 | grep ImageThe output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0Pod
norepsample-0:kubectl describe pod norepsample-0 | grep ImageThe output is similar to the following:
Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0 Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0The Pods are running the new image.
- (Optional) Confirm the state of the TimesTenClassic object.
kubectl get ttc norepsampleThe output is similar to the following:
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 62m - Verify the databases are running the correct release.
- Establish a shell in the
-0Pod.kubectl exec -it norepsample-0 -c tt -- /bin/bash - Run the TimesTen
ttVersionutility.ttVersionThe output is similar to the following:TimesTen Release 22.1.1.35.0 (64 bit Linux/x86_64) (instance1:6624) 2025-01-16T15:16:01Z Instance admin: timesten Instance home directory: /tt/home/timesten/instances/instance1 Group owner: timesten Daemon home directory: /tt/home/timesten/instances/instance1/info PL/SQL enabled. - Exit from the shell.
- Establish a shell in the
-1Pod.kubectl exec -it norepsample-1 -c tt -- /bin/bash - Run the TimesTen
ttVersionutility.ttVersionThe output is similar to the following:TimesTen Release 22.1.1.35.0 (64 bit Linux/x86_64) (instance1:6624) 2025-01-16T15:16:01Z Instance admin: timesten Instance home directory: /tt/home/timesten/instances/instance1 Group owner: timesten Daemon home directory: /tt/home/timesten/instances/instance1/info PL/SQL enabled. - Exit from the shell.
- Establish a shell in the
-2Pod.kubectl exec -it norepsample-2 -c tt -- /bin/bash - Run the TimesTen
ttVersionutility.ttVersionThe output is similar to the following:TimesTen Release 22.1.1.35.0 (64 bit Linux/x86_64) (instance1:6624) 2025-01-16T15:16:01Z Instance admin: timesten Instance home directory: /tt/home/timesten/instances/instance1 Group owner: timesten Daemon home directory: /tt/home/timesten/instances/instance1/info PL/SQL enabled. - Exit from the shell.
The TimesTen databases are running the correct release of TimesTen. - Establish a shell in the
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.