レプリケートされないTimesTenデータベースのアップグレード
3つの独立したTimesTenデータベースで構成される、レプリケートされないTimesTenClassicオブジェクトのアップグレードを実行します。
-
YAMLファイルを作成します。このファイルでは、TimesTenの新しいリリースを含むコンテナ・イメージを指定します。
-
アップグレードに
helmvaluesコマンドを使用します。この例は、この方法を示しています。
また、この例では、rollingUpdatePartition変数の値を変更する方法を示します。
- 開発ホストで、新しいHelmチャートを含む
helmディレクトリに移動します。cd new_kube_files/helm - YAMLファイルを作成し、そのファイルにアップグレードに使用するTimesTenイメージの名前を指定します。
vi customyaml/upgradenonreplicated.yaml image: repository: container-registry.oracle.com/timesten/timesten tag: "22.1.1.35.0" - アップグレードの前に、次の手順を実行します:
- レプリケートされないTimesTenClassicオブジェクトがネームスペースに存在することを確認します。
kubectl get ttc出力は、次のようになります。NAME STATE ACTIVE AGE norepsamplehelm AllReplicasReady N/A 10h repsamplehelm Normal repsamplehelm-1 13hnorepsamplehelmTimesTenClassicオブジェクトが存在し、AllReplicasReady状態です。 - イメージおよび
rollingUpdatePartitionの値を確認します。kubectl get ttc norepsamplehelm -o yaml | grep 'image\|rollingUpdatePartition'出力は、次のようになります。image: container-registry.oracle.com/timesten/timesten:22.1.1.34.0 ... rollingUpdatePartition: 2 ...rollingUpdatePartitionの値は2で、Kubernetesが2以上の序数値でポッドをアップグレードすることを示します。norepsamplehelmオブジェクトの場合、replicasの値は3であるため、norepsamplehelm-0、norepsamplehelm-1およびnorepsamplehelm-2という3つのポッドがあります。したがって、Kubernetesはnorepsamplehelm-2ポッドのみをアップグレードします。
- レプリケートされないTimesTenClassicオブジェクトがネームスペースに存在することを確認します。
ttclassicチャートのリリースを確認します。helm list出力は、次のようになります。NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION norepsamplehelm default 1 2025-01-16 17:42:47.180635098 +0000 UTC deployed ttclassic-2211340.1.0 22.1.1.34.0- 新しいリリースにアップグレードします。新しいリリースの
ttclassicチャートを使用し、新しいイメージを参照するカスタマイズされたYAMLファイルを使用します。ノート:
次の構文をお薦めします。これにより、既存のカスタマイズが保持されます。helm get values norepsamplehelm --all > prev-values-norepttc.yamlhelm upgrade -f prev-values-norepttc.yaml -f customyaml/upgradenonreplicated.yaml norepsamplehelm ./ttclassic次のhelmupgradeコマンドを見てみましょう。-
get values norepsamplehelmHelmコマンドは、既存のカスタマイズを含む現在のリリースの値を取得します。このコマンドの結果は、prev-values-norepttc.yamlファイルにパイプされます。このファイルには任意の名前を選択できます。 -
helmupgradeコマンドは、カスタマイズしたupgradenonreplicated.yamlファイルとともにprev-values-norepttc.yamlファイルを使用してアップグレードを実行します。
helmupgradeコマンドの出力を見てみましょう。Release "norepsamplehelm" has been upgraded. Happy Helming! NAME: norepsamplehelm LAST DEPLOYED: Thu Jan 16 04:22:15 2025 NAMESPACE: default STATUS: deployed REVISION: 2 NOTES: Version 2211350.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.次の点に注目してください。-
norepsamplehelmチャート・リリースがアップグレードされています。リリース・リビジョンは2です。 -
リリースのステータスは
deployedです。 -
ttclassicチャートのバージョンは、TimesTenリリース22.1.1.35.0に対応する2211350.1.0です。
-
- 進捗を監視します。
kubectl get ttc norepsamplehelm出力は、次のようになります。
NAME STATE ACTIVE AGE norepsamplehelm SomeReplicasReady N/A 10hオブジェクトは
SomeReplicasReady状態です。数分間待機します。次に、再度監視します。
kubectl get ttc norepsamplehelm出力は、次のようになります。
NAME STATE ACTIVE AGE norepsamplehelm AllReplicasReady N/A 10hオブジェクトは
AllReplicasReady状態です。すべてのレプリカが準備でき、使用可能になります。TimesTenデータベースは稼働中であり、正しく機能しています。 norepsamplehelm-2ポッドが実行しているイメージを確認します。kubectl describe pod norepsamplehelm-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ポッド内のコンテナでは、新しいコンテナ・イメージが実行されています。
norepsamplehelm-1およびnorepsamplehelm-0ポッドのイメージを確認します。norepsamplehelm-1ポッドを確認します。kubectl describe pod norepsamplehelm-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はこのポッドを新しいイメージでアップグレードしません。これは正常な動作です。norepsamplehelm-0ポッドを確認します。kubectl describe pod norepsamplehelm-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はこのポッドを新しいイメージでアップグレードしません。これは正常な動作です。
アップグレードが機能していることを確認したら、残りのポッドをアップグレードできます。- YAMLファイルを作成し、そのファイルに
rollingUpdatePartition変数を指定し、値を0に設定します。vi customyaml/changerollingupdate.yaml rollingUpdatePartition: 0 rollingUpdatePartition値を変更します。ノート:
次の構文をお薦めします。これにより、既存のカスタマイズが保持されます。helm get values norepsamplehelm --all > prev-values-noreprolling.yaml && helm upgrade -f prev-values-noreprolling.yaml -f customyaml/changerollingupdate.yaml norepsamplehelm ./ttclassic出力は、次のようになります。Release "norepsamplehelm" has been upgraded. Happy Helming! NAME: norepsamplehelm LAST DEPLOYED: Thu Jan 16 04:56:32 2025 NAMESPACE: default STATUS: deployed REVISION: 3 NOTES: Version 2211350.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は自動的にポッドを終了し、新しいポッドに置き換えます。これらの新しいポッドは新しいイメージを実行します。
rollingUpdatePartitionは現在0であるため、新しいイメージでアップグレードされたnorepsamplehelm-1およびnorepsamplehelm-0ポッドが表示されます。- 進捗を監視します。
- TimesTenClassicオブジェクト:
kubectl get ttc norepsamplehelm出力は次のようになります
NAME STATE ACTIVE AGE norepsamplehelm SomeReplicasReady N/A 11h - Pods:
kubectl get pods出力は、次のようになります。
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 34mKubernetesは、最初に
norepsamplehelm-1ポッドを置き換えます。数分間待機します。次に、再度監視します。kubectl get pods出力は、次のようになります。
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 40mKubernetesにより、
norepsamplehelm-1およびnorepsamplehelm-0ポッドが置き換わりました。すべてのポッドが実行されています。
- TimesTenClassicオブジェクト:
- ポッドが新しいコンテナ・イメージを実行していることを確認します。
ポッド
norepsamplehelm-1:kubectl describe pod norepsamplehelm-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ポッド
norepsamplehelm-0:kubectl describe pod norepsamplehelm-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 norepsamplehelm出力は、次のようになります。
NAME STATE ACTIVE AGE norepsamplehelm AllReplicasReady N/A 11h
おめでとうございます。レプリケートされないTimesTenClassicオブジェクトの自動アップグレードが正常に実行されました。すべてのレプリカが準備でき、使用可能になります。ポッドでは、新しいTimesTenコンテナ・イメージが実行されています。TimesTenデータベースはアップグレードされ、完全に動作しています。