- Kubernetesオペレータ・ユーザーズ・ガイド
- アップグレードの実行
- レプリケートされないTimesTenClassicオブジェクトの自動アップグレードの実行
レプリケートされない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.28.0
を使用します。- ファイルを編集し、
image
値をcontainer-registry.oracle.com/timesten/timesten:22.1.1.28.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/v2 kind: TimesTenClassic ... image: container-registry.oracle.com/timesten/timesten:22.1.1.28.0 ...
- ファイルを保存して、エディタを終了します。
- ファイルを編集し、
- StatefulSetに新しいイメージが含まれていることを確認します。
kubectl describe statefulset norepsample | grep Image
出力は次のようになります。
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
TimesTenオペレータは、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.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
ポッド内のコンテナでは、新しいコンテナ・イメージが実行されています。
norepsample-1
およびnorepsample-0
ポッドのイメージを確認します。norepsample-1
ポッドを確認します。kubectl describe pod norepsample-1 | grep Image
出力は、次のようになります。
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
ポッド内のコンテナでは、新しいイメージは実行されていません。
2
のrollingUpdatePartition
値により、Kubernetesはこのポッドを新しいイメージでアップグレードしません。これは正常な動作です。norepsample-0
ポッドを確認します。kubectl describe pod norepsample-0 | grep Image
出力は、次のようになります。
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
ポッド内のコンテナでは、新しいイメージは実行されていません。
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/v2 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 36m
Kubernetesは、最初に
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 38m
Kubernetesは
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.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
ポッド
norepsample-0
:kubectl describe pod norepsample-0 | grep Image
出力は、次のようになります。
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
ポッドでは、新しいイメージが実行されています。
- (オプション) 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.28.0 (64 bit Linux/x86_64) (instance1:6624) 2024-05-17T15: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.28.0 (64 bit Linux/x86_64) (instance1:6624) 2024-05-17T15: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.28.0 (64 bit Linux/x86_64) (instance1:6624) 2024-05-17T15: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データベースはアップグレードされ、完全に動作しています。