0

We are trying to create MySQL pod with databases ready by cloning PVC of already running MySQL pod.

Use case: we have a staging environment with database imported and want to create dynamic environments based off that database structure and data. This approach should save us significant bootstrapping time (download and import of dump vs clone of the PV). However once we have target MySQL pod running with cloned PVC attached, we can't see any databases available in it. MySQL starts normally, recognises /var/lib/mysql/mysql directory and skips new db setup, however databases are not there. Details:

  • MySQL image: mysql:5.7
  • we use InnoDb
  • we scale-in source StatefulSet before taking clone (expecting source MySQL saves everything to disk)
  • PVC is mounted as:
    volumeMounts:
      - name: mysql-data
        mountPath: /var/lib/mysql
    

What are we missing?

  • You did not mention it so I must ask: Are you sure that your CSI driver implements cloning? https://kubernetes-csi.github.io/docs/drivers.html – Matt Dec 23 '20 at 11:09
  • @Matt apparently EBS CSI supports cloning, but new PVC comes empty. Not sure why, but according to the documentation, VolumeSnapshot has the feature we are looking for – Anton Andrushchenko Dec 24 '20 at 14:38

1 Answers1

1

Apparently the issue was related to the AWS EBS CSI. Volume Cloning does not seem to work, however VolumeSnapshot feature might solve the issue.