Upgrading CloudNative-PG 1.22.0

CloudNativePG1.22.0がリリースされたようなのでアップグレード。

主な変更点はこちらの記事を参照

Upgrading Operator

kubectl apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.22/releases/cnpg-1.22.0.yaml

Operatorがアップグレードされると、PostgreSQL Clusterも自動的に再起動される。

アップグレード完了後のステータス。

Instances status
Name       Database Size  Current LSN  Replication role  Status  QoS         Manager Version  Node
----       -------------  -----------  ----------------  ------  ---         ---------------  ----
cnpg161-2  74 MB          20/9E005E60  Primary           OK      BestEffort  1.22.0           dok8s-vke1-np1-74aee82fc0a9
cnpg161-1  74 MB          20/9E005E60  Standby (sync)    OK      BestEffort  1.22.0           dok8s-vke1-np1-c31b703042b2

Upgrading CNPG Client module

curl -sSfL https://github.com/cloudnative-pg/cloudnative-pg/raw/main/hack/install-cnpg-plugin.sh | sudo sh -s -- -b /usr/local/bin

バージョン確認

kubectl cnpg version

【出力例】

Build: {Version:1.22.0 Commit:86b9dc80 Date:2023-12-21}

Upgrading PostgreSQL Cluster

manifestを更新、spec:imageNameを”ghcr.io/cloudnative-pg/postgresql:16.1″に変更。


apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cnpg161
  namespace: cnpg161
spec:
  imageName: ghcr.io/cloudnative-pg/postgresql:16.1
  instances: 2
  minSyncReplicas: 1
  maxSyncReplicas: 1

  postgresql:
    parameters:
      shared_buffers: 128MB
  
  storage:
    storageClass: vultr-block-storage
    size: 10Gi

  monitoring:
    enablePodMonitor: true

  backup:
    barmanObjectStore:
      destinationPath: "s3://dok8s/vke-cnpg/"
      endpointURL: "https://syd1.digitaloceanspaces.com"
      s3Credentials:
        accessKeyId:
          name: backup-creds
          key: ACCESS_KEY_ID
        secretAccessKey:
          name: backup-creds
          key: ACCESS_SECRET_KEY
      wal:
        compression: gzip
        encryption: AES256
      data:
        compression: gzip
        encryption: AES256
        immediateCheckpoint: false
        jobs: 2
    retentionPolicy: "30d"
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
  name: backup-cnpg161
spec:
  schedule: "1 1 */6 * * *"
  backupOwnerReference: self
  cluster:
    name: cnpg161

更新したマニフェストを適用。

kubectl -n cnpg161 apply -f cluster-cnpg161.yml

ステータスを確認。

kubectl cnpg -n cnpg161 status cnpg161
Cluster Summary
Name:                cnpg161
Namespace:           cnpg161
System ID:           7303351267317084179
PostgreSQL Image:    ghcr.io/cloudnative-pg/postgresql:16.1
Primary instance:    cnpg161-2
Primary start time:  2023-11-30 11:01:52 +0000 UTC (uptime 542h25m3s)
Status:              Cluster in healthy state
Instances:           2
Ready instances:     2
Current Write LSN:   20/A4001F70 (Timeline: 4 - WAL File: 0000000400000020000000A4)

psqlで接続してバージョン確認

kubectl cnpg -n cnpg161 psql cnpg161
psql (16.1 (Debian 16.1-1.pgdg110+1))
Type "help" for help.

postgres=# select version();
                                                           version
-----------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 16.1 (Debian 16.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 row)

postgres=#

Upgrading Grafana Dashboard

モニタリング用のGrafana Dashboardをアップグレード。

kubectl -n monitoring apply -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/main/docs/src/samples/monitoring/grafana-configmap.yaml

OverviewがSummaryという文言になっているなど若干変更されている。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です