レプリケートされないTimesTenアップグレードのロールバック

Helmを使用して、レプリケートされないTimesTenClassicオブジェクトのアップグレードをロールバックできます。これにより、レプリケートされないTimesTenClassicオブジェクトとその関連TimesTenデータベースがダウングレードされたリリースに戻ります。

  1. ロールバックの前に、次を実行します:
    1. レプリケートされないTimesTenClassicオブジェクトがネームスペースに存在することを確認します。
      kubectl get ttc 
      出力は、次のようになります。
      NAME              STATE              ACTIVE            AGE
      norepsamplehelm   AllReplicasReady   N/A               20h
      repsamplehelm     Normal             repsamplehelm-0   23h
      

      norepsamplehelm TimesTenClassicオブジェクトが存在し、AllReplicasReady状態です。

    2. イメージおよびrollingUpdatePartitionの値を確認します。
      kubectl get ttc norepsamplehelm -o yaml | grep 'image\|rollingUpdatePartition'
      出力は、次のようになります。
          image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0
      ...
          rollingUpdatePartition: 0
      ...

      rollingUpdatePartitionの現在の値は0です。ただし、ダウングレードに使用される値は、rollingUpdatePartitionの元の値です。この例では、元の値は2です。rollingUpdatePartition値が2の元のチャート・リリースにロールバックすると、Kubernetesは-2ポッドのみをダウングレードします。次のステップがこれを示しています。

  2. リビジョン履歴を確認します。
    helm history norepsamplehelm
    出力は、次のようになります。
    
    REVISION        UPDATED                         STATUS          CHART                   APP VERSION     DESCRIPTION
    1               Thu Jan  16 17:42:47 2025        superseded      ttclassic-2211340.1.0   22.1.1.34.0     Install complete
    2               Fri Jan  17 04:22:15 2025        superseded      ttclassic-2211350.1.0   22.1.1.35.0     Upgrade complete
    3               Fri Jan  17 04:56:32 2025        deployed        ttclassic-2211350.1.0   22.1.1.35.0     Upgrade complete

    norepsamplehelmチャートのリビジョン3は、リリース22.1.1.35.0を実行しています。リビジョン1はリリース22.1.1.34.0を実行しています。

  3. リビジョン1にロールバックします。
    helm rollback norepsamplehelm 1

    出力は次のようになります。

    Rollback was a success! Happy Helming!
  4. 進捗を監視します。
    kubectl get ttc norepsamplehelm

    出力は、次のようになります。

    NAME              STATE               ACTIVE   AGE
    norepsamplehelm   SomeReplicasReady   N/A      20h

    オブジェクトはSomeReplicasReady状態です。

    数分間待機します。次に、再度監視します。

    kubectl get ttc norepsamplehelm

    出力は、次のようになります。

    NAME              STATE              ACTIVE   AGE
    norepsamplehelm   AllReplicasReady   N/A      20h

    オブジェクトはAllReplicasReady状態です。すべてのレプリカが準備でき、使用可能になります。TimesTenデータベースは稼働中であり、正しく機能しています。

  5. rollingUpdatePartition値とポッドのイメージを確認します。
    1. rollingUpdatePartitionの値を確認します。
      kubectl get ttc norepsamplehelm -o yaml | grep rollingUpdatePartition

      出力は、次のようになります。

      rollingUpdatePartition: 2

      ダウングレード・プロセスの一環として、rollingUpdatePartitionの値は2の元の値に変更されます。

    2. norepsamplehelm-2ポッドを確認します。
      kubectl describe pod norepsamplehelm-2 | 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

      ポッド内のコンテナでは、ダウングレードされたイメージが実行されています。2rollingUpdatePartition値により、Kubernetesはこのポッドをダウングレードされたイメージで更新しました。これは正常な動作です。

    3. 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

      ポッド内のコンテナでは、ダウングレードされたイメージは実行されていません。2rollingUpdatePartition値により、Kubernetesはこのポッドをダウングレードされたイメージで更新しません。これは正常な動作です。

    4. 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

      ポッド内のコンテナでは、ダウングレードされたイメージは実行されていません。2rollingUpdatePartition値により、Kubernetesはこのポッドをダウングレードされたイメージで更新しません。これは正常な動作です。

    ダウングレードが機能していることを確認したら、残りのポッドをダウングレードできます。
  6. 新しいYAMLファイルを作成し、そのファイルにrollingUpdatePartition変数を指定し、値を0に設定します。
    vi customyaml/changerollingupdate0.yaml
    
    rollingUpdatePartition: 0
  7. rollingUpdatePartition値を変更します。

    ノート:

    次の構文をお薦めします。これにより、既存のカスタマイズが保持されます。
    helm get values norepsamplehelm --all > prev-values-noreprolling0.yaml && helm upgrade -f prev-values-noreprolling0.yaml -f customyaml/changerollingupdate0.yaml  norepsamplehelm ./ttclassic
    出力は、次のようになります。
    Release "norepsamplehelm" has been upgraded. Happy Helming!
    NAME: norepsamplehelm
    LAST DEPLOYED: Fri Jan  17 15:09:42 2025
    NAMESPACE: default
    STATUS: deployed
    REVISION: 5
    NOTES:
    Version 2211340.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ポッドが表示されます。

  8. 進捗を監視します。
    1. TimesTenClassicオブジェクト:
      kubectl get ttc norepsamplehelm

      出力は次のようになります

      NAME              STATE               ACTIVE            AGE
      norepsamplehelm   SomeReplicasReady   N/A               21h
    2. Pods:
      kubectl get pods

      出力は、次のようになります。

      NAME                                 READY   STATUS     RESTARTS        AGE
      norepsamplehelm-0                    3/3     Running    0               10h
      norepsamplehelm-1                    0/3     Init:0/1   0               73s
      norepsamplehelm-2                    3/3     Running    0               34m

      Kubernetesは、最初にnorepsamplehelm-1ポッドを置き換えます。数分間待機します。次に、再度監視します。

      kubectl get pods

      出力は、次のようになります。

      NAME                                 READY   STATUS    RESTARTS        AGE
      norepsamplehelm-0                    3/3     Running   0               7m24s
      norepsamplehelm-1                    3/3     Running   0               9m49s
      norepsamplehelm-2                    3/3     Running   0               42m

      Kubernetesにより、norepsamplehelm-1およびnorepsamplehelm-0ポッドが置き換わりました。すべてのポッドが実行されています。

  9. ポッドがダウングレードされたコンテナ・イメージを実行していることを確認します。

    ポッド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

    ポッド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

    ポッドでは、新しいイメージが実行されています。

  10. rollingUpdatePartitionの値を確認します。
    kubectl get ttc norepsamplehelm -o yaml | grep rollingUpdatePartition

    出力は、次のようになります。

    rollingUpdatePartition: 0
  11. TimesTenClassicオブジェクトの状態を確認します。
    kubectl get ttc norepsamplehelm

    出力は、次のようになります。

    NAME              STATE              ACTIVE   AGE
    norepsamplehelm   AllReplicasReady   N/A      21h
  12. 履歴を確認します。
    helm history norepsamplehelm

    出力は、次のようになります。

    REVISION        UPDATED                         STATUS          CHART                   APP VERSION     DESCRIPTION
    1               Thu Jan  16 17:42:47 2025        superseded      ttclassic-2211340.1.0   22.1.1.34.0     Install complete
    2               Fri Jan  17 04:22:15 2025        superseded      ttclassic-2211350.1.0   22.1.1.35.0     Upgrade complete
    3               Fri Jan  17 04:56:32 2025        superseded      ttclassic-2211350.1.0   22.1.1.35.0     Upgrade complete
    4               Fri Jan  17 14:36:43 2025        superseded      ttclassic-2211340.1.0   22.1.1.34.0     Rollback to 1
    5               Fri Jan  17 15:09:42 2025        deployed        ttclassic-2211340.1.0   22.1.1.34.0     Upgrade complete

    リビジョン5は、2211340.1.0チャートを実行しています。

  13. norepsamplehelmリリースがダウングレードされていることを確認します。
    helm list
    出力は、次のようになります。
    NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
    norepsamplehelm default         5               2025-01-07 15:09:42.959017268 +0000 UTC deployed        ttclassic-2211340.1.0   22.1.1.34.0

    norepsamplehelmチャート・リリースがダウングレードされています。

おめでとうございます。ロールバックは正常に完了しました。TimesTenClassicオブジェクトは目的のリリースにダウングレードされ、AllReplicasReady状態です。すべてのレプリカが準備でき、使用可能になります。ポッドでは、ダウングレードされたTimesTenコンテナ・イメージが実行されています。TimesTenデータベースはアップグレードされ、完全に動作しています。