2. アップグレード

2.1. 目的

本書では、Exastro システムのアップグレード方法について紹介します。

2.2. 前提条件

  • Exastro システムが導入済みであること

  • クライアント要件

    動作確認が取れているクライアントアプリケーションのバージョンは下記のとおりです。
    表 2.239 クライアント要件

    アプリケーション

    バージョン

    Helm

    v3.9.x

    kubectl

    1.23

2.3. アップグレードの準備

警告

アップグレード実施前に データバックアップ・リストア の手順に従い、バックアップを取得しておくことを推奨します。

2.3.1. Helm リポジトリの更新

Exastro システムの Helm リポジトリを更新します。
更新前のバージョンを確認します。
リスト 2.190 コマンド
1# リポジトリ情報の確認
2helm search repo exastro
リスト 2.191 実行結果
1helm search repo exastro
2NAME                            CHART VERSION   APP VERSION     DESCRIPTION
3exastro/exastro                 1.0.0           2.0.3           A Helm chart for Exastro. Exastro is an Open So...
4exastro/exastro-it-automation   1.2.0           2.0.3           A Helm chart for Exastro IT Automation. Exastro...
5exastro/exastro-platform        1.5.0           1.4.0           A Helm chart for Exastro Platform. Exastro Plat...
Helm リポジトリを更新します。
リスト 2.192 コマンド
1# リポジトリ情報の更新
2helm repo update
更新後のバージョンを確認します。
リスト 2.193 コマンド
1# リポジトリ情報の確認
2helm search repo exastro
リスト 2.194 実行結果
1helm search repo exastro
2NAME                            CHART VERSION   APP VERSION     DESCRIPTION
3exastro/exastro                 1.0.1           2.1.0           A Helm chart for Exastro. Exastro is an Open So...
4exastro/exastro-it-automation   1.2.0           2.0.3           A Helm chart for Exastro IT Automation. Exastro...
5exastro/exastro-platform        1.5.0           1.4.0           A Helm chart for Exastro Platform. Exastro Plat...

2.3.2. デフォルト設定値の更新の確認

デフォルト値の更新を確認します。
インストール時に作成した設定ファイル exastro.yaml とアップグレード後の設定ファイルを比較します。
リスト 2.195 コマンド
diff exastro.yaml <(helm show values exastro/exastro)
リスト 2.196 実行結果
exastro-platform:
  platform-api:
    image:
      repository: "exastro/exastro-platform-api"
       tag: ""

  platform-auth:
+    extraEnv:
+      # Please set the URL to access
+      EXTERNAL_URL: ""
+      EXTERNAL_URL_MNG: ""
    ingress:
      enabled: true
      hosts:
        - host: exastro-suite.example.local
          paths:

2.3.3. 設定値の更新

デフォルト設定値の比較結果から、項目の追加などにより設定値の追加が必要な場合は更新をしてください。
設定値の更新が不要であればこの手順はスキップしてください。
例えば下記の差分確認結果から、exastro-platform.platform-auth.extraEnv が追加されていますので、必要に応じて、exastro.yaml に項目と設定値を追加します。
リスト 2.197 実行結果
exastro-platform:
  platform-api:
    image:
      repository: "exastro/exastro-platform-api"
       tag: ""

  platform-auth:
+    extraEnv:
+      # Please set the URL to access
+      EXTERNAL_URL: ""
+      EXTERNAL_URL_MNG: ""
    ingress:
      enabled: true
      hosts:
        - host: exastro-suite.example.local
          paths:

2.4. アップグレード

2.4.1. サービス停止

  1. Pod 起動数の確認

    作業前の Pod 起動数の確認をし、状態を記録します。
    リスト 2.198 コマンド
    RS_AE=`kubectl get deploy ita-by-ansible-execute -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_ALRV=`kubectl get deploy ita-by-ansible-legacy-role-vars-listup -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_ATS=`kubectl get deploy ita-by-ansible-towermaster-sync -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_CS=`kubectl get deploy ita-by-conductor-synchronize -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_MC=`kubectl get deploy ita-by-menu-create -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    RS_PA=`kubectl get deploy platform-auth -o jsonpath='{@.spec.replicas}{"\n"}' -n exastro`
    
  2. リバースプロキシの停止

    リバースプロキシ (platform-auth) の Pod 起動数を 0 に変更し、エンドユーザーからのアクセスを制限します。
    リスト 2.199 コマンド
    kubectl scale deployment platform-auth -n exastro --replicas=0
    
  3. バックヤード処理の停止

    バックヤード処理 (ita-by-***) の Pod 起動数を 0 に変更し、データベースの更新を停止します。
    リスト 2.200 コマンド
    kubectl scale deployment ita-by-ansible-execute -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-legacy-role-vars-listup -n exastro --replicas=0
    kubectl scale deployment ita-by-ansible-towermaster-sync -n exastro --replicas=0
    kubectl scale deployment ita-by-conductor-synchronize -n exastro --replicas=0
    kubectl scale deployment ita-by-menu-create -n exastro --replicas=0
    
  4. Pod 起動数の確認

    上記で停止した対象の Pod 数が 0 になっていることを確認
    リスト 2.201 コマンド
    kubectl get deployment -n exastro
    
    リスト 2.202 実行結果
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    mariadb                                  1/1     1            1           3h41m
    ita-web-server                           1/1     1            1           3h41m
    platform-web                             1/1     1            1           3h41m
    ita-api-admin                            1/1     1            1           3h41m
    ita-api-organization                     1/1     1            1           3h41m
    platform-api                             1/1     1            1           3h41m
    keycloak                                 1/1     1            1           3h41m
    ita-by-menu-create                       0/0     0            0           3h41m
    ita-by-ansible-execute                   0/0     0            0           3h41m
    ita-by-ansible-legacy-role-vars-listup   0/0     0            0           3h41m
    ita-by-ansible-towermaster-sync          0/0     0            0           3h41m
    ita-by-conductor-synchronize             0/0     0            0           3h41m
    platform-auth                            0/0     0            0           3h41m
    

2.4.2. アップグレード実施

アップグレードを実施します。
リスト 2.203 コマンド
helm upgrade exastro exastro/exastro \
  --namespace exastro \
  --values exastro.yaml
リスト 2.204 出力結果
NAME: exastro
LAST DEPLOYED: Sat Jan 28 15:00:02 2023
NAMESPACE: exastro
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
Exastro install completion!

1. Execute the following command and wait until the pod becomes "Running" or "Completed":

  # NOTE: You can also append "-w" to the command or wait until the state changes with "watch command"

  kubectl get pods --namespace exastro

2. Get the ENCRYPT_KEY by running these commands:

  # Exastro IT Automation ENCRYPT_KEY
  kubectl get secret ita-secret-ita-global -n exastro -o jsonpath='{.data.ENCRYPT_KEY}' | base64 -d

  # Exastro Platform ENCRYPT_KEY
  kubectl get secret platform-secret-pf-global -n exastro -o jsonpath='{.data.ENCRYPT_KEY}' | base64 -d

  !!! Please save the output ENCRYPT_KEY carefully. !!!

3. Run the following command to get the application URL and go to the URL or go to the displayed URL:
  *************************
  * Service Console       *
  *************************
  http://exastro-suite.example.local/

  *************************
  * Administrator Console *
  *************************
  http://exastro-suite-mng.example.local/auth/


  # Note: You can display this note again by executing the following command.

2.4.3. サービス再開

  1. サービス再開

    サービス停止時に取得した各 Deployment の Pod 起動数を元に戻します。
    リスト 2.205 コマンド
    kubectl scale deployment ita-by-ansible-execute -n exastro --replicas=${RS_AE}
    kubectl scale deployment ita-by-ansible-legacy-role-vars-listup -n exastro --replicas=${RS_ALRV}
    kubectl scale deployment ita-by-ansible-towermaster-sync -n exastro --replicas=${RS_ATS}
    kubectl scale deployment ita-by-conductor-synchronize -n exastro --replicas=${RS_CS}
    kubectl scale deployment ita-by-menu-create -n exastro --replicas=${RS_MC}
    kubectl scale deployment platform-auth -n exastro --replicas=${RS_PA}
    
  2. Pod 起動数の確認

    上記で起動した対象の Pod 数が元に戻りすべて READY になっていることを確認
    リスト 2.206 コマンド
    kubectl get deployment -n exastro
    
    リスト 2.207 実行結果
    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
    mariadb                                  1/1     1            1           3h7m
    ita-web-server                           1/1     1            1           3h7m
    platform-web                             1/1     1            1           3h7m
    ita-api-admin                            1/1     1            1           3h7m
    ita-api-organization                     1/1     1            1           3h7m
    platform-api                             1/1     1            1           3h7m
    keycloak                                 1/1     1            1           3h7m
    ita-by-ansible-legacy-role-vars-listup   1/1     1            1           3h7m
    ita-by-conductor-synchronize             1/1     1            1           3h7m
    ita-by-ansible-execute                   1/1     1            1           3h7m
    ita-by-ansible-towermaster-sync          1/1     1            1           3h7m
    platform-auth                            1/1     1            1           3h7m
    ita-by-menu-create                       0/0     0            0           3h7m
    

2.4.4. アップグレード状況確認

コマンドラインから以下のコマンドを入力して、アップグレードが完了していることを確認します。
リスト 2.208 コマンド
# Pod の一覧を取得
kubectl get po -n exastro
正常動作している場合は、すべて “Running” もしくは “Completed” となります。
※正常に起動するまで数分かかる場合があります。
リスト 2.209 出力結果
NAME                                                      READY   STATUS      RESTARTS   AGE
mariadb-67dd78cc76-mzm25                                  1/1     Running     0          61m
ita-setup-jl6pw                                           0/1     Completed   0          61m
platform-migration                                        0/1     Completed   0          61m
ita-web-server-6b7d5db55f-4n4sr                           1/1     Running     0          10m
platform-web-6d48987995-28p6b                             1/1     Running     0          10m
platform-auth-6ff45cb6b5-7fvmk                            1/1     Running     0          10m
ita-by-conductor-synchronize-b6b59c745-x7fkx              1/1     Running     0          10m
ita-api-admin-57bdc864b5-wtndv                            1/1     Running     0          10m
ita-api-organization-7c8b957f64-8ffv9                     1/1     Running     0          10m
ita-by-ansible-legacy-role-vars-listup-67fb9fd59c-6qmnq   1/1     Running     0          10m
ita-by-ansible-execute-5656785f6b-m2lcv                   1/1     Running     0          10m
ita-by-ansible-towermaster-sync-7fff49df5f-wvg84          1/1     Running     0          10m
ita-by-menu-create-6b4fc66bdf-r6cg2                       1/1     Running     0          10m
platform-api-5468bf6674-ncxtd                             1/1     Running     0          10m
keycloak-7dd65794c7-w5wpg                                 1/1     Running     0          10m