レプリケートされないTimesTenClassicオブジェクトの自動アップグレードの実行
- ネームスペースで実行されているTimesTenClassicオブジェクトを確認します。
kubectl get ttc出力は、次のようになります。
NAME STATE ACTIVE AGE mannorepsample AllReplicasReady N/A 3h47m norepsample AllReplicasReady N/A 4d10s repsample Normal repsample-0 5d23hレプリケートされないTimesTenClassicオブジェクトの1つは、
norepsampleです。高レベル状態はAllReplicasReadyで、すべてのレプリカが準備でき、使用可能であることを示します。TimesTenデータベースは稼働中であり、正しく機能しています。 - オブジェクトのイメージ・アップグレード・ストラテジおよびローリング更新パーティション値を確認します。
kubectl get ttc norepsample -o yaml | grep 'imageUpgradeStrategy\|rollingUpdatePartition'出力は次のようになります。
imageUpgradeStrategy: Auto rollingUpdatePartition: 2イメージ・アップグレード・ストラテジは
Auto(デフォルト)で、自動アップグレード・ストラテジを示します。rollingUpdatePartitionの値は2で、Kubernetesが2以上の序数値でポッドをアップグレードすることを示します。norepsampleオブジェクトの場合、replicasの値は3であるため、norepsample-0、norepsample-1およびnorepsample-2という3つのポッドがあります。したがって、Kubernetesはnorepsample-2ポッドのみをアップグレードします。これを確認するには、アップグレードを実行します。 - 開発ホストで、アップグレードに使用するコンテナ・イメージを使用して、TimesTenClassicオブジェクトの
.spec.ttspec.imageデータ項目を編集します。この例では、container-registry.oracle.com/timesten/timesten:22.1.1.35.0を使用します。- ファイルを編集し、
image値をcontainer-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 ... - ファイルを保存して、エディタを終了します。
- ファイルを編集し、
- StatefulSetに新しいイメージが含まれていることを確認します。
kubectl describe statefulset norepsample | grep Image出力は次のようになります。
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.0TimesTenオペレータは、TimesTenClassicの
.spec.ttspec.imageデータ項目への更新があることを検出すると、新しいイメージでStatefulSetを変更します。これは自動アップグレードであるため、TimesTenオペレータはこれ以降の処理を実行しませんが、Kubernetesは処理を実行します。Kubernetesは自動的にポッドを終了し、新しいポッドに置き換えます。これらの新しいポッドは新しいイメージを実行します。rollingUpdatePartitionは2であるため、新しいイメージでアップグレードされたnorepsample-2ポッドのみが表示されます。 - 進捗を監視します。
kubectl get ttc norepsample出力は、次のようになります。
NAME STATE ACTIVE AGE norepsample SomeReplicasReady N/A 16mオブジェクトは
SomeReplicasReady状態です。数分間待機します。次に、再度監視します。
kubectl get ttc norepsample出力は、次のようになります。
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 19mオブジェクトは
AllReplicasReady状態です。すべてのレプリカが準備でき、使用可能になります。TimesTenデータベースは稼働中であり、正しく機能しています。 norepsample-2ポッドが実行しているイメージを確認します。kubectl describe pod norepsample-2 | grep Image出力は、次のようになります。
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ポッド内のコンテナでは、新しいコンテナ・イメージが実行されています。
norepsample-1およびnorepsample-0ポッドのイメージを確認します。norepsample-1ポッドを確認します。kubectl describe pod norepsample-1 | grep Image出力は、次のようになります。
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ポッド内のコンテナでは、新しいイメージは実行されていません。
2のrollingUpdatePartition値により、Kubernetesはこのポッドを新しいイメージでアップグレードしません。これは正常な動作です。norepsample-0ポッドを確認します。kubectl describe pod norepsample-0 | grep Image出力は、次のようになります。
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ポッド内のコンテナでは、新しいイメージは実行されていません。
2のrollingUpdatePartition値により、Kubernetesはこのポッドを新しいイメージでアップグレードしません。これは正常な動作です。
アップグレードが機能していることを確認したら、残りのポッドをアップグレードできます。- TimesTenClassicオブジェクトの
.spec.ttspec.rollingUpdatePartitionデータ項目を編集し、値を2から0に変更します。- ファイルを編集し、
rollingUpdatePartition値を2に置き換えます。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 ... - ファイルを保存して、エディタを終了します。
Kubernetesは自動的にポッドを終了し、新しいポッドに置き換えます。これらの新しいポッドは新しいイメージを実行します。
rollingUpdatePartitionは現在0であるため、新しいイメージでアップグレードされたnorepsample-1およびnorepsample-0ポッドが表示されます。 - ファイルを編集し、
- 進捗を監視します。
- TimesTenClassicオブジェクト:
kubectl get ttc norepsample出力は次のようになります
NAME STATE ACTIVE AGE norepsample SomeReplicasReady N/A 51m - Pods:
kubectl get pods出力は、次のようになります。
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は、最初に
norepsample-1ポッドを置き換えます。数分間待機します。次に、再度監視します。kubectl get pods出力は、次のようになります。
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は
norepsample-1ポッドの置換えを完了し、norepsample-0ポッドを置き換えています。再度確認します。
kubectl get pods出力は、次のようになります。
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すべてのポッドが実行されています。
- TimesTenClassicオブジェクト:
- ポッドが新しいコンテナ・イメージを実行していることを確認します。
ポッド
norepsample-1:kubectl describe pod norepsample-1 | grep Image出力は、次のようになります。
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ポッド
norepsample-0:kubectl describe pod norepsample-0 | grep Image出力は、次のようになります。
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ポッドでは、新しいイメージが実行されています。
- (オプション) TimesTenClassicオブジェクトの状態を確認します。
kubectl get ttc norepsample出力は、次のようになります。
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 62m - データベースが正しいリリースを実行していることを確認します。
-0ポッドにシェルを設定します。kubectl exec -it norepsample-0 -c tt -- /bin/bash- TimesTen
ttVersionユーティリティを実行します。ttVersion出力は、次のようになります。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. - シェルを終了します。
-1ポッドにシェルを設定します。kubectl exec -it norepsample-1 -c tt -- /bin/bash- TimesTen
ttVersionユーティリティを実行します。ttVersion出力は、次のようになります。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. - シェルを終了します。
-2ポッドにシェルを設定します。kubectl exec -it norepsample-2 -c tt -- /bin/bash- TimesTen
ttVersionユーティリティを実行します。ttVersion出力は、次のようになります。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. - シェルを終了します。
TimesTenデータベースでは、TimesTenの正しいリリースが実行されています。
おめでとうございます。レプリケートされないTimesTenClassicオブジェクトの自動アップグレードが正常に実行されました。すべてのレプリカが準備でき、使用可能になります。ポッドでは、新しいTimesTenコンテナ・イメージが実行されています。TimesTenデータベースはアップグレードされ、完全に動作しています。