Created
July 2, 2020 10:30
-
-
Save iceman91176/20fae63534e1fdc14e78d033fcdb6648 to your computer and use it in GitHub Desktop.
Migration of Data from one PVC to another
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: NAME | |
namespace: NS | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
volumeMode: Filesystem | |
resources: | |
requests: | |
storage: SIZE | |
storageClassName: csi-ceph-dc1-standard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: migration-NAME | |
namespace: NS | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
volumeMode: Filesystem | |
resources: | |
requests: | |
storage: SIZE | |
storageClassName: csi-ceph-dc1-standard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: migration-backup | |
namespace: NS | |
spec: | |
containers: | |
- name: migration-backup | |
image: busybox | |
args: | |
- sleep | |
- "1000000" | |
volumeMounts: | |
- name: source | |
mountPath: /data-source | |
- name: destination | |
mountPath: /data-destination | |
volumes: | |
- name: source | |
persistentVolumeClaim: | |
claimName: SOURCEPVC | |
readOnly: false | |
- name: destination | |
persistentVolumeClaim: | |
claimName: migration-SOURCEPVC | |
readOnly: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: migration-restore | |
namespace: NS | |
spec: | |
containers: | |
- name: migration-restore | |
image: busybox | |
args: | |
- sleep | |
- "1000000" | |
volumeMounts: | |
- name: source | |
mountPath: /data-source | |
- name: destination | |
mountPath: /data-destination | |
volumes: | |
- name: source | |
persistentVolumeClaim: | |
claimName: migration-SOURCEPVC | |
readOnly: false | |
- name: destination | |
persistentVolumeClaim: | |
claimName: SOURCEPVC | |
readOnly: false |
@iceman91176 Why do an extra step with a temp pvc instead of directly copy all the data to target pvc?
@FedeMarchiniHotovo The target-PVC is essentially the same as the source PVC - same name, same labels, etc. So you cannot create it as long as the source-pvc exists.
I see, thanks !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good to hear that it still works ;-) I created an ansible role for those migration jobs a couple of months ago that automates pvc-migration, so we don't need those scripts any more.