k3s-cluster/kubernetes/main/apps/database/postgresql/cluster/cluster16.yaml

84 lines
2.3 KiB
YAML
Raw Permalink Normal View History

---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/postgresql.cnpg.io/cluster_v1.json
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgres16
namespace: database
spec:
instances: 3
imageName: ghcr.io/cloudnative-pg/postgresql:16.4-28
primaryUpdateStrategy: unsupervised
storage:
size: 20Gi
storageClass: openebs-zfs-mainpool
superuserSecret:
name: cloudnative-pg-secret
enableSuperuserAccess: true
postgresql:
parameters:
max_connections: "400"
shared_buffers: 256MB
nodeMaintenanceWindow:
inProgress: false
reusePVC: true
resources:
requests:
cpu: 500m
limits:
memory: 4Gi
monitoring:
enablePodMonitor: true
backup:
retentionPolicy: 30d
barmanObjectStore: &barmanObjectStore
data:
compression: bzip2
wal:
compression: bzip2
maxParallel: 8
destinationPath: s3://cloudnative-pg/
endpointURL: http://minio.database.svc:9000
# Note: serverName version needs to be inclemented
# when recovering from an existing cnpg cluster
serverName: &currentCluster postgres16-v2
s3Credentials:
accessKeyId:
name: cloudnative-pg-secret
key: minioAccessKey
secretAccessKey:
name: cloudnative-pg-secret
key: minioSecretKey
# Note: previousCluster needs to be set to the name of the previous
# cluster when recovering from an existing cnpg cluster
bootstrap:
recovery:
source: &previousCluster postgres16-v1
# initdb:
# import:
# type: monolith
# databases:
# - "*"
# roles:
# - "*"
# source:
# externalCluster: old-cluster
# Note: externalClusters is needed when recovering from an existing cnpg cluster
externalClusters:
- name: *previousCluster
barmanObjectStore:
<<: *barmanObjectStore
serverName: *previousCluster
# - name: old-cluster
# connectionParameters:
# # Use the correct IP or host name for the source database
# host: postgresql.database.svc
# user: postgres
# dbname: postgres
# #sslmode: require
# password:
# name: cloudnative-pg-secret
# key: password