レプリケートされないTimesTenClassicオブジェクトの自動アップグレードの実行

3つの独立したTimesTenデータベースで構成されるレプリケートされないTimesTenClassicオブジェクトの自動アップグレードを実行します。
  1. ネームスペースで実行されている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データベースは稼働中であり、正しく機能しています。

  2. オブジェクトのイメージ・アップグレード・ストラテジおよびローリング更新パーティション値を確認します。
    kubectl get ttc norepsample -o yaml | grep 'imageUpgradeStrategy\|rollingUpdatePartition'

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

    imageUpgradeStrategy: Auto
    rollingUpdatePartition: 2

    イメージ・アップグレード・ストラテジはAuto (デフォルト)で、自動アップグレード・ストラテジを示します。rollingUpdatePartitionの値は2で、Kubernetesが2以上の序数値でポッドをアップグレードすることを示します。norepsampleオブジェクトの場合、replicasの値は3であるため、norepsample-0norepsample-1およびnorepsample-2という3つのポッドがあります。したがって、Kubernetesはnorepsample-2ポッドのみをアップグレードします。これを確認するには、アップグレードを実行します。

  3. 開発ホストで、アップグレードに使用するコンテナ・イメージを使用して、TimesTenClassicオブジェクトの.spec.ttspec.imageデータ項目を編集します。この例では、container-registry.oracle.com/timesten/timesten:22.1.1.28.0を使用します。
    1. ファイルを編集し、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
      ...
    2. ファイルを保存して、エディタを終了します。
  4. 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は自動的にポッドを終了し、新しいポッドに置き換えます。これらの新しいポッドは新しいイメージを実行します。rollingUpdatePartition2であるため、新しいイメージでアップグレードされたnorepsample-2ポッドのみが表示されます。

  5. 進捗を監視します。
    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データベースは稼働中であり、正しく機能しています。

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

    ポッド内のコンテナでは、新しいコンテナ・イメージが実行されています。

  7. norepsample-1およびnorepsample-0ポッドのイメージを確認します。
    1. 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

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

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

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

    アップグレードが機能していることを確認したら、残りのポッドをアップグレードできます。
  8. TimesTenClassicオブジェクトの.spec.ttspec.rollingUpdatePartitionデータ項目を編集し、値を2から0に変更します。
    1. ファイルを編集し、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
      ...
    2. ファイルを保存して、エディタを終了します。

    Kubernetesは自動的にポッドを終了し、新しいポッドに置き換えます。これらの新しいポッドは新しいイメージを実行します。rollingUpdatePartitionは現在0であるため、新しいイメージでアップグレードされたnorepsample-1およびnorepsample-0ポッドが表示されます。

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

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

      NAME          STATE               ACTIVE   AGE
      norepsample   SomeReplicasReady   N/A      51m
    2. 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
      

      すべてのポッドが実行されています。

  10. ポッドが新しいコンテナ・イメージを実行していることを確認します。

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

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

  11. (オプション) TimesTenClassicオブジェクトの状態を確認します。
    kubectl get ttc norepsample

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

    NAME          STATE              ACTIVE   AGE
    norepsample   AllReplicasReady   N/A      62m
  12. データベースが正しいリリースを実行していることを確認します。
    1. -0ポッドにシェルを設定します。
      kubectl exec -it norepsample-0 -c tt -- /bin/bash
    2. 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.
      
    3. シェルを終了します。
    4. -1ポッドにシェルを設定します。
      kubectl exec -it norepsample-1 -c tt -- /bin/bash
    5. 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.
      
    6. シェルを終了します。
    7. -2ポッドにシェルを設定します。
      kubectl exec -it norepsample-2 -c tt -- /bin/bash
    8. 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.
      
    9. シェルを終了します。
    TimesTenデータベースでは、TimesTenの正しいリリースが実行されています。

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