mysql-operator icon indicating copy to clipboard operation
mysql-operator copied to clipboard

PersistenteVolume deleting when stopping the pod

Open enoliveira opened this issue 4 years ago • 5 comments

This is my yaml file:

apiVersion: mysql.presslabs.org/v1alpha1
kind: MysqlCluster
metadata:
  name: {{ .Values.magento_database_cluster.name }} 
  namespace: {{ .Values.namespace.name }}
spec:
  replicas: 1
  secretName: magento-database-users 
  initBucketURL: {{ .Values.magento_database.backup }}
  initBucketSecretName: mysql-database-storage-secret  
  volumeSpec:
    persistentVolumeClaim:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 15Gi
  backupCompressCommand:
    - pigz
    - --stdout  
  backupDecompressCommand:
    - gzip 
  rcloneExtraArgs:
    - --buffer-size=1G
    - --multi-thread-streams=8
    - --retries-sleep=10s
    - --retries=10

Every time I stop the pod the volume is getting deleted. It creates the persistenteVolume and persistenteVolumeClaim.

Using: minikube + skaffold + helm 3 image

Am I missing something?

Thanks

enoliveira avatar Jan 08 '21 22:01 enoliveira

Hi @enoliveira, how do you stop the pod? The PVC gets deleted but only for replicas when the cluster is scaled-down and never for the master pod or index 0.

What version of k8s are you using?

Thank you!

AMecea avatar Jan 18 '21 06:01 AMecea

Kubernetes version v1.20.

I'm using Skaffold to deploy. When I stop the deployment though Skaffold all volumes are persistent except the MysqlCluster.

enoliveira avatar Jan 18 '21 20:01 enoliveira

It can be because of the k8s version. I didn't test on 1.20. We have a cleanup task that removes PVC if not used. I have to revise that.

Thank you!

AMecea avatar Jan 19 '21 15:01 AMecea

me too

k8s version 1.17

jicki avatar Apr 09 '21 07:04 jicki

me too

k8s version 1.21

alexciw avatar Oct 16 '23 13:10 alexciw