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 ’ 오퍼레이터를 업그레이드하려면 다음 단계를 따르십시오.

  1. 만들고 허용 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"
     
  2. Postgres 운영자를 업그레이드하십시오. 다음 명령어에서 이전 단계에서 <UID from namespace> 얻은 UID를 로 사용하십시오:

    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
     
  3. 클러스터 구성을 수정하여 ` 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
    '
     
  4. 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 호스트에서 다음 단계를 완료하십시오.

  1. 이미지를 내부 이미지 레지스트리에 재태그하십시오.

    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
                   
  2. 이미지를 귀하의 백도어 호스트에 있는 내부 이미지 레지스트리로 푸시하십시오.

    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
                   
  3. 클러스터에서 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 로 시작하는 1000750000/10000 10, 1000750000000개의 값을 나타내므로, ID 의 범위부터 1000750000 까지를 지정합니다 1000760000. 이 예시에서 값은 파일 시스템 그룹 ID( 1000750000 UID)로 사용될 수 있습니다.

  4. 추가하고 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"
     
  5. Postgres Operator를 업그레이드합니다. 다음 명령어에서 <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.yaml
       
    • Kubernetes 클러스터

      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
       
  6. 클러스터 구성을 수정하여 ` 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
    '
     
  7. Postgres 확인(온라인 및 오프라인) 단계를 완료하십시오.

Postgres 검증 (온라인 및 오프라인)

Postgres 인스턴스와 데이터 저장소를 확인하려면 다음 단계를 따르십시오.

  1. Postgres 운영자 업그레이드를 확인하십시오.

    kubectl get all -n instana-postgres
     

    Postgres 오퍼레이터가 성공적으로 배포되면, 명령어의 결과는 다음과 같습니다:

    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
     
  2. 포드가 원하는 노드에 스케줄링되었는지 확인하십시오.

    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>