Postgres データストアのアップグレード Linux x86_64
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 データストアをオンラインでアップグレードするには、以下の手順を完了してください。
クラスタ 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)として使用される可能性があります。Postgres オペレータをアップグレードしてください。
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以下のパッチを適用して、 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.0Postgres の検証(オンラインおよびオフライン) の手順を完了してください。
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)として使用される可能性があります。Postgres オペレータをアップグレードしてください。
Red Hat OpenShift
helm upgrade --install cnpg cloudnative-pg-0.28.2.tgz \ --set image.repository=<internal-image-registry>/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> \ --set image.imagePullSecrets[0].name="<internal-image-registry-pull-secret>" \ -n instana-postgresKubernetes クラスター
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 \ --set image.imagePullSecrets[0].name="<internal-image-registry-pull-secret>" \ -n instana-postgres
Postgres クラスタ構成を更新します。例
postgres.yaml: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