1

I have created a Persistant Disk Claim for my Postgres Database.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: pgdata
  name: pgdata
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}

Once I delete the cluster, the volume got deleted too. what's the best practice here? Should I save in some other Persistent Disk like GCEPersistentDisk? I dont want to lose the volume even If cluster is deleted and what are the best strategies for deployment?

1 Answer 1

2

In the PersistenVolume manifest you can set the reclaiming policy (Retain or Delete, there was a third option now deprecated - Recycle):

persistentVolumeReclaimPolicy: Retain

Reference: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#claims-as-volumes

Sign up to request clarification or add additional context in comments.

2 Comments

Is this the right way to use in Production? I cannot afford losing the postgres volume data so I'm just being careful.
I use Retain in production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.