Linux on IBM Z and LinuxONE 上の Postgres データストアの更新
Postgres オペレーターをアップグレードします。
準備
オンラインおよびオフラインのホストが外部リポジトリから画像を取得できるように準備してください。 また、正しい Helm リポジトリが追加されていることを確認してください。
Postgres デプロイ用のオペレーターバージョンとイメージタグ
以下の画像は、固定された Helm チャートまたはオペレータバージョンに必要なものです。
| プラットフォーム | オペレーターのバージョン | Helm チャートのバージョン | タグ付きの画像 |
|---|---|---|---|
| Linux® x86_64 | 1.29.1 | 0.28.2 | artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg: v1.29.1_v0.34.0 artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers: 15_v0.39.0 |
CloudNativePG オペレータを使用した Postgres のオンラインアップグレード
オンライン環境で Postgres Operatorをアップグレードするには、以下の手順を実行してください。
作成し
custom_values.yaml、許容誤差と親和性を指定します。 ファイルがすでに作成されている場合は、この手順をスキップしてください。tolerations: - key: node.instana.io/monitor operator: Equal effect: NoSchedule value: "true" affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: node-role.kubernetes.io/monitor operator: In values: - "true"Postgres オペレーターをアップグレードします。 前の手順で取得したUIDを、次のコマンドの
<UID from namespace>として使用してください:helm upgrade --install cnpg instana/cloudnative-pg --set image.repository=artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg --set image.tag=v1.29.1_v0.34.0 --version=0.28.2 --set imagePullSecrets[0].name=instana-registry --set containerSecurityContext.runAsUser=<UID from namespace> --set containerSecurityContext.runAsGroup=<UID from namespace> -n instana-postgres -f custom_values.yamlクラスタ構成にパッチを適用して、 Postgres を更新します。
kubectl patch cluster postgres -n instana-postgres --type=merge --patch ' spec: imageName: artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers:15_v0.39.0 'Postgres の検証(オンラインおよびオフライン) の手順を完了してください。
CloudNative PGオペレータを使用した Postgres のオフラインアップグレード
エアギャップ環境における Postgres オペレーターのアップグレード
外部レジストリから Postgres イメージをまだ取得していない場合は、今すぐ取得できます。 以下のコマンドをバスタウンホストで実行してください。 次に、それらの画像をエアギャップ環境にある Instana ホストにコピーします。
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg:v1.29.1_v0.34.0
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers:15_v0.39.0
Instana ホストで以下の手順を完了してください。
画像を内部画像レジストリに再タグ付けしてください。
docker tag artifact-public.instana.io/self-hosted-images/3rd-party/operator/cloudnative-pg:v1.29.1_v0.34.0 <internal-image-registry>/operator/cloudnative-pg:v1.29.1_v0.34.0 docker tag artifact-public.instana.io/self-hosted-images/3rd-party/datastore/cnpg-containers:15_v0.39.0 <internal-image-registry>/datastore/cnpg-containers:15_v0.39.0画像をバスタインホスト上の内部画像レジストリにプッシュする。
docker push <internal-image-registry>/operator/cloudnative-pg:v1.29.1_v0.34.0 docker push <internal-image-registry>/datastore/cnpg-containers:15_v0.39.0クラスタ Red Hat® OpenShift® 上で Postgres をアップグレードする場合は、ネーム
instana-postgresスペースからファイルシステムグループIDを特定してください。 Red Hat OpenShift ファイルシステムグループは、名前空間固有の値の範囲内にある必要があります。kubectl get namespace instana-postgres -o yamlコマンドの実行結果は以下の例に類似した出力が表示されます:
apiVersion: v1 kind: Namespace metadata: annotations: ....... openshift.io/sa.scc.uid-range: 1000750000/10000 creationTimestamp: "2024-01-14T07:04:59Z" labels: kubernetes.io/metadata.name: instana-postgres ....... name: instana-postgres注釈
openshift.io/sa.scc.supplemental-groupsには許可されたIDの範囲が含まれています。 範囲はIDから始まる10,1000750000/10000000個の値を示すため1000750000、IDの範囲をから1000750000まで指定します1000760000。 この例では、値はファイルシステムのグループID1000750000(UID)として使用される可能性があります。を追加し
custom_values.yaml、許容誤差と親和性を指定します。 ファイルがすでに作成されている場合は、この手順をスキップしてください。tolerations: - key: node.instana.io/monitor operator: Equal effect: NoSchedule value: "true" affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: node-role.kubernetes.io/monitor operator: In values: - "true"Postgres オペレーターをアップグレードします。 次のコマンドでは、<download_key> の値を、ご自身のエージェントキーに置き換えてください。
Red Hat OpenShift クラスター
次のコマンドでは、前の手順
<UID from namespace>で取得したUIDを として使用してください:helm upgrade --install cnpg cloudnative-pg-1.28.0.tgz --set image.repository=image-registry.openshift-image-registry.svc:5000/instana-postgres/cloudnative-pg-operator --set image.tag=v1.29.1_v0.34.0 --version=0.28.2 --set containerSecurityContext.runAsUser=<UID from namespace> --set containerSecurityContext.runAsGroup=<UID from namespace> -n instana-postgres -f custom_values.yamlKubernetes クラスター
helm upgrade --install cnpg cloudnative-pg-0.28.2.tgz --set image.repository=<internal-image-registry>/operator/cloudnative-pg --set image.tag=v1.29.1_v0.34.0 --version=0.28.2 -n instana-postgres
クラスタ構成にパッチを適用して、 Postgres を更新します。
kubectl patch cluster postgres -n instana-postgres --type=merge --patch ' spec: imageName: <internal-image-registry>/self-hosted-images/3rd-party/datastore/cnpg-containers:15_v0.39.0 'Postgres の検証(オンラインおよびオフライン) の手順を完了してください。
Postgres の検証(オンラインおよびオフライン)
以下の手順に従って、 Postgres インスタンスとデータストアを確認してください。
Postgres オペレーターのアップグレードを確認してください。
kubectl get all -n instana-postgresPostgres オペレーターのデプロイが正常に完了した場合、コマンドの結果は次のようになります:
NAME READY STATUS RESTARTS AGE pod/postgres-1 1/1 Running 0 100s pod/postgres-2 1/1 Running 0 69s pod/postgres-3 1/1 Running 0 41s pod/cnpg-cloudnative-pg-64bbc87958-fqnrl 1/1 Running 0 11m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT service/cnpg-webhook-service ClusterIP 172.30.66.183 <none> 443/TCP service/postgres-r ClusterIP 172.30.163.146 <none> 5432/TCP service/postgres-ro ClusterIP 172.30.226.75 <none> 5432/TCP service/postgres-rw ClusterIP 172.30.235.178 <none> 5432/TCP NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/cnpg-cloudnative-p 1/1 1 1 11m NAME DESIRED CURRENT READY AGE replicaset.apps/cnpg-cloudnative-pg-64bbc87958 1 1 1 11mポッドが希望のノードにスケジュールされていることを確認してください。
kubectl get pods -n instana-postgres -o wide以下の例に、出力例を示します。
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES cnpg-cloudnative-pg-7cdf76c49c-kztxr 1/1 Running 0 22d 10.254.20.122 worker0.instana-load-testing.cp.fyre.ibm.com <none> <none> postgres-1 1/1 Running 0 22d 10.254.20.124 worker0.instana-load-testing.cp.fyre.ibm.com <none> <none> postgres-3 1/1 Running 0 22d 10.254.16.93 worker1.instana-load-testing.cp.fyre.ibm.com <none> <none> postgres-4 1/1 Running 0 22d 10.254.24.65 worker3.instana-load-testing.cp.fyre.ibm.com <none> <none>