Upgrading Postgres data store on Linux on Power (ppc64le)

Install the Postgres operator and set up the data store.

Before you begin

Make sure that you prepared your online and offline host to pull images from the external repository. Also, ensure that the correct Helm repo is added.

Postgres operator versions and image tags

The following images are needed for the pinned Helm chart or operator versions.

CNPG Postgres

Platform Operator versions Helm chart version Image with tag
Linux on Power (ppc64le) v1.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

Zalando Postgres

Platform Operator versions Helm chart version Image with tag
Linux on Power (ppc64le) 1.10.0 v1.10.1 artifact-public.instana.io/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0 artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0

Upgrading Postgres online

Upgrade the Postgres operator in an online environment.

Upgrading Postgres by using the CloudNativePG operator

Complete these steps to upgrade Postgres data store.

  1. If you are upgrading Postgres on a Red Hat OpenShift cluster, determine the file system group ID from the instana-postgres namespace. Red Hat OpenShift requires that file system groups are within a range of values specific to the namespace.

    kubectl get namespace instana-postgres -o yaml
     

    An output similar to the following example is shown for the command:

    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
     

    The openshift.io/sa.scc.supplemental-groups annotation contains the range of allowed IDs. The range 1000750000/10000 indicates 10,000 values starting with ID 1000750000, so it specifies the range of IDs from 1000750000 to 1000760000. In this example, the value 1000750000 might be used as a file system group ID (UID).

  2. Upgrade the Postgres operator.

    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
     
  3. Update the Postgres cluster resource by applying the following patch:

    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.40.0
    '
     
  4. Complete the steps in Verifying Postgres (online and offline).

Upgrading Postgres by using the Zalando operator

To upgrade Zalando Postgres operator online, complete the following steps:

  1. Create a file, for example values.yaml, with the Postgres configuration.

    configGeneral:
      kubernetes_use_configmaps: true
    securityContext:
      runAsUser: 101
    image:
      registry: artifact-public.instana.io
      repository: self-hosted-images/3rd-party/operator/zalando
      tag: "v1.10.0_v0.1.0"
    imagePullSecrets:
      - name: instana-registry
    configKubernetes:
      pod_service_account_definition: |
        apiVersion: v1
        kind: ServiceAccount
        metadata:
          name: postgres-pod
        imagePullSecrets:
          - name: instana-registry
    podServiceAccount:
      name: postgres-pod
     
  2. Upgrade the Postgres operator.

    helm upgrade --install postgres-operator instana/postgres-operator \
      --version=v1.10.1 \
      -f values.yaml \
      -n instana-postgres
     
  3. Update the Postgres cluster resource by applying the following patch:

    kubectl patch postgresql postgres -n instana-postgres --type=merge --patch '
    spec:
      dockerImage: artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0
    '
     
  4. Complete the steps in Verifying Postgres (online and offline).

Upgrading Postgres offline

Upgrade the Postgres operator in an air-gapped environment.

Upgrading Postgres offline by using the CloudNative PG operator

If you didn't yet pull the Postgres images from the external registry, you can pull them now. Run the following commands on your bastion host. Then, copy the images to your Instana host that is in your air-gapped environment.

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
            

Complete the following steps on your Instana host.

  1. Retag the images to your internal image registry.

    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. Push the images to your internal image registry on your bastion host.

    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. If you are upgrading Postgres on a Red Hat OpenShift cluster, determine the file system group ID from the instana-postgres namespace. Red Hat OpenShift requires that file system groups are within a range of values specific to the namespace.

    kubectl get namespace instana-postgres -o yaml
     

    An output similar to the following example is shown for the command:

    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
     

    The openshift.io/sa.scc.supplemental-groups annotation contains the range of allowed IDs. The range 1000750000/10000 indicates 10,000 values starting with ID 1000750000, so it specifies the range of IDs from 1000750000 to 1000760000. In this example, the value 1000750000 might be used as a file system group ID (UID).

  4. Upgrade the Postgres operator. In the following command, update the <download_key> value with your own agent key. If you created an image pull secret for your internal registry, add --docker-server=<internal-image-registry>:<internal-image-registry-port> to the following command.

    • Red Hat OpenShift cluster

      Use the UID from the previous step as the <UID from namespace> in the following commands:

      helm upgrade --install cnpg cloudnative-pg-1.28.0.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> -n instana-postgres
       
    • Kubernetes cluster

      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
       
  5. Upgrade Postgres by running to the following command to patch Postgres custom resource.

    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.40.0
      '
     
  6. Complete the steps in Verifying Postgres (online and offline).

Upgrading Postgres offline by using the Zalando operator

If you are using a Red Hat OpenShift cluster, create Security Context Constraints before you deploy the Postgres operator.

  1. Update the YAML file, for example postgres-scc.yaml, with the SCC resource definition.

    apiVersion: security.openshift.io/v1
    kind: SecurityContextConstraints
    metadata:
      name: postgres-scc
    runAsUser:
      type: MustRunAs
      uid: 101
    seLinuxContext:
      type: RunAsAny
    fsGroup:
      type: RunAsAny
    allowHostDirVolumePlugin: false
    allowHostNetwork: true
    allowHostPorts: true
    allowPrivilegedContainer: false
    allowHostIPC: true
    allowHostPID: true
    readOnlyRootFilesystem: false
    users:
      - system:serviceaccount:instana-postgres:postgres-operator
      - system:serviceaccount:instana-postgres:postgres-pod
      - system:serviceaccount:instana-postgres:default
     

Then, proceed with upgrading the Postgres operator.

If you didn't yet pull the Postgres images from the external registry, you can pull them now. Run the following commands on your bastion host. Then, copy the images to your Instana host that is in your air-gapped environment.

docker pull artifact-public.instana.io/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0
docker pull artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0
            

Complete the following steps on your Instana host.

  1. Retag the images to your internal image registry.

    docker tag artifact-public.instana.io/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0 <internal-image-registry>/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0
    docker tag artifact-public.instana.io/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0 <internal-image-registry>/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0
                      
  2. Push the images to your internal image registry on your bastion host.

    docker push <internal-image-registry>/self-hosted-images/3rd-party/operator/zalando:v1.10.0_v0.1.0
    docker push <internal-image-registry>/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0
                      
  3. Update the YAML file, for example values.yaml, with the Postgres configuration.

    configGeneral:
    kubernetes_use_configmaps: true
    securityContext:
    runAsUser: 101
    image:
    registry: <internal-image-registry>
    repository: self-hosted-images/3rd-party/operator/zalando
    tag: "v1.10.0_v0.1.0" 
    imagePullSecrets:
    - name: instana-registry
    configKubernetes:
    pod_service_account_definition: |
     apiVersion: v1
     kind: ServiceAccount
     metadata:
       name: postgres-pod
     imagePullSecrets:
       - name: instana-registry
    podServiceAccount:
    name: postgres-pod
     
  4. Upgrade the Postgres operator. If you created an image pull secret in the previous step, add --set imagePullSecrets[0].name="<internal-image-registry-pull-secret>" to the following command.

    helm upgrade --install postgres-operator postgres-operator-ppc64le-1.10.0.tgz \
      --version=1.10.0 \
      --set configGeneral.kubernetes_use_configmaps=true \
      --set securityContext.runAsUser=101 \
      --namespace=instana-postgres \
      --set image.registry=<internal-image-registry> \
      --set image.repository=ppc64le-oss/postgres-operator-ppc64le \
      --set image.tag=v1.10.0_v0.1.0
                      
  5. Upgrade Postgres by running the following command to patch Postgres custom resource.

    kubectl patch postgresql postgres -n instana-postgres --type=merge --patch '
    spec:
      dockerImage: <internal-image-registry>/self-hosted-images/3rd-party/datastore/zalando:15.7_v0.1.0
    '
     
  6. Complete the steps in Verifying Postgres (online and offline).

Verifying Postgres (online and offline)

Complete these steps to verify Postgres instance and data store.

  1. Verify the Postgres operator upgrade.

    kubectl get all -n instana-postgres
     

    If the Postgres operator is deployed successfully, then the result of the command is as follows:

    • The following output is an example for Zalando operator:

      NAME                                     READY   STATUS    RESTARTS   AGE
      pod/postgres-0                           1/1     Running   0          100s
      pod/postgres-1                           1/1     Running   0          69s
      pod/postgres-2                           1/1     Running   0          41s
      pod/postgres-operator-766455c58c-ntmpf   1/1     Running   0          11m
      
      NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
      service/postgres            ClusterIP   192.168.1.107   <none>        5432/TCP   101s
      service/postgres-operator   ClusterIP   192.168.1.35    <none>        8080/TCP   11m
      service/postgres-repl       ClusterIP   192.168.1.72    <none>        5432/TCP   101s
      
      NAME                                READY   UP-TO-DATE   AVAILABLE   AGE
      deployment.apps/postgres-operator   1/1     1            1           11m
      
      NAME                                           DESIRED   CURRENT   READY   AGE
      replicaset.apps/postgres-operator-766455c58c   1         1         1       11m
      
      NAME                        READY   AGE
      statefulset.apps/postgres   3/3     103s
      
      NAME                                                    IMAGE                             CLUSTER-LABEL   SERVICE-ACCOUNT   MIN-INSTANCES   AGE
      operatorconfiguration.acid.zalan.do/postgres-operator   ghcr.io/zalando/spilo-15:3.0-p1   cluster-name    postgres-pod      -1              11m
      
      NAME                                TEAM      VERSION   PODS   VOLUME   CPU-REQUEST   MEMORY-REQUEST   AGE    STATUS
      postgresql.acid.zalan.do/postgres   instana   15        3      10Gi     500m          2Gi              106s   Running
       
    • The following output is an example for CloudNativePG operator:

      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
       

Migrating data from Zalando to CloudNativePG

By using the pg_basebackup bootstrap mode, you can create a new PostgreSQL cluster (target) that replicates the exact physical state of an existing PostgreSQL instance (source).

You can bootstrap from a live cluster through a valid streaming replication connection, and by using the source PostgreSQL instance either as a primary or a standby PostgreSQL server.

To migrate the data from a Zalando PostgreSQL cluster, through the pg_basebackup bootstrap mode, to a CloudNativePG replica cluster, see Migrating data from Zalando to CloudNativePG.