zalando / zalando/postgres-operator

When delete postgres the pvc stay bound to pv , But all data deleted (role+tabels and more ..)

Open
#2,269 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Go
Stars
5.2k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
3

Description

Please, answer some short questions which should help us to understand your problem / question better?

  • Which image of the operator are you using? registry.opensource.zalan.do/acid/postgres-operator:vv1.7.1
  • **Where do you run it - cloud , Kubernetes (Rke2)
  • Are you running Postgres Operator in production? yes
  • Type of issue? question

i use operator with postgres 14 and i create pvc with storageclass reclain policy retain.

when i delete the postgres (not the operator) the pv and pvc stay connected , but all the data is deleted. (role,tabels..)

there is option to save the data ?

pvc.yaml:

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pgdata-acid-14-0
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 10Gi
  storageClassName: postgres-data

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pgdata-acid-14-1
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 10Gi
  storageClassName: postgres-data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pgdata-acid-14-2
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 10Gi
  storageClassName: postgres-data

postgres.yaml:

apiVersion: "acid.zalan.do/v1"
kind: postgresql
metadata:
  name: acid-14
spec:
  teamId: "acid"
  spiloFSGroup: 103
  resources:
    limits:
      cpu: 500m
      memory: 500Mi
    requests:
      cpu: 100m
      memory: 100Mi  
  allowedSourceRanges:
    - 0.0.0.0/0
  volume:
    size: 10Gi

  numberOfInstances: 3
  users:
    # database owner
    zalando:
    - superuser
    - createdb

  tls:
    caFile: ca.crt
    caSecretName: pg-tls-ca
    secretName: pg-tls

  postgresql:
    version: "14"

storageclass.yaml:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: postgres-data
provisioner:  cluster.local/nfs-external-provisioner
reclaimPolicy: Retain
parameters:
  archiveOnDelete: "false"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the supplied pvc.yaml, postgres.yaml, and storageclass.yaml, then reproduce deletion with the PostgreSQL 14 cluster and inspect the PVC and PV lifecycle in Kubernetes. Compare the operator's behavior with the configured Retain policy and the NFS provisioner's archiveOnDelete setting. Done means explaining whether the data should remain and identifying the supported configuration or documenting the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes, postgresql
Domain
databases, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.