Perform an Automated Upgrade of a Non-Replicated TimesTenClassic Object
- Review the TimesTenClassic objects running in your namespace.
kubectl get ttc
The output is similar to the following:
NAME STATE ACTIVE AGE mannorepsample AllReplicasReady N/A 3h47m norepsample AllReplicasReady N/A 4d10s repsample Normal repsample-0 5d23h
One 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: 2
The image upgrade strategy is
Auto
(also the default), indicating an automated upgrade strategy. The value forrollingUpdatePartition
is2
, indicating that Kubernetes upgrades Pods with an ordinal value greater than or equal to2
. For thenorepsample
object, since the value ofreplicas
is3
, there are three Pods namednorepsample-0
,norepsample-1
, andnorepsample-2
. Therefore, Kubernetes only upgrades thenorepsample-2
Pod. Let's verify this by performing the upgrade. - On your development host, edit the TimesTenClassic object's
.spec.ttspec.image
datum 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
image
value 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 Image
The 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.0
When the TimesTen Operator detects that there is an update to the TimesTenClassic's
.spec.ttspec.image
datum, 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. SincerollingUpdatePartition
is2
, you should expect to see only thenorepsample-2
Pod upgraded with the new image. - Monitor the progress.
kubectl get ttc norepsample
The output is similar to the following:
NAME STATE ACTIVE AGE norepsample SomeReplicasReady N/A 16m
The object is in the
SomeReplicasReady
state.Wait a few minutes. Then, monitor again.
kubectl get ttc norepsample
The output is similar to the following:
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 19m
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
norepsample-2
Pod is running.kubectl describe pod norepsample-2 | grep Image
The 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.0
The containers in the Pod are running the new container image.
- Check the image for the
norepsample-1
andnorepsample-0
Pods.- Check the
norepsample-1
Pod.kubectl describe pod norepsample-1 | grep Image
The 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.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
norepsample-0
Pod.kubectl describe pod norepsample-0 | grep Image
The 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.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
- Edit the TimesTenClassic object's
.spec.ttspec.rollingUpdatePartition
datum and change the value from2
to0
.- Edit the file, replacing the
rollingUpdatePartition
value 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
rollingUpdatePartition
is now0
, you should expect to see thenorepsample-1
andnorepsample-0
Pods upgraded with the new image. - Edit the file, replacing the
- Monitor the progress.
- TimesTenClassic object:
kubectl get ttc norepsample
The output is similar to the following
NAME STATE ACTIVE AGE norepsample SomeReplicasReady N/A 51m
- Pods:
kubectl get pods
The 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 36m
Kubernetes replaces the
norepsample-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 ... norepsample-0 0/3 Init:0/1 0 46s norepsample-1 3/3 Running 0 3m41s norepsample-2 3/3 Running 0 38m
Kubernetes replaced the
norepsample-1
Pod and is in the process of replacing thenorepsample-0
Pod.Check again.
kubectl get pods
The 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 43m
All Pods are running.
- TimesTenClassic object:
- Confirm the Pods are running the new container image.
Pod
norepsample-1:
kubectl describe pod norepsample-1 | grep Image
The 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.0
Pod
norepsample-0
:kubectl describe pod norepsample-0 | grep Image
The 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.0
The Pods are running the new image.
- (Optional) Confirm the state of the TimesTenClassic object.
kubectl get ttc norepsample
The 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
-0
Pod.kubectl exec -it norepsample-0 -c tt -- /bin/bash
- Run the TimesTen
ttVersion
utility.ttVersion
The 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
-1
Pod.kubectl exec -it norepsample-1 -c tt -- /bin/bash
- Run the TimesTen
ttVersion
utility.ttVersion
The 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
-2
Pod.kubectl exec -it norepsample-2 -c tt -- /bin/bash
- Run the TimesTen
ttVersion
utility.ttVersion
The 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.