bitpoke / mysql-operator

Asynchronous MySQL Replication on Kubernetes using Percona Server and Openark's Orchestrator.
https://www.bitpoke.io/docs/mysql-operator/getting-started/
Apache License 2.0
1.04k stars 276 forks source link

PersistenteVolume deleting when stopping the pod #646

Open enoliveira opened 3 years ago

enoliveira commented 3 years ago

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

AMecea commented 3 years ago

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!

enoliveira commented 3 years ago

Kubernetes version v1.20.

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

AMecea commented 3 years ago

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!

jicki commented 3 years ago

me too

k8s version 1.17
alexciw commented 1 year ago

me too

k8s version 1.21