data-migrate utility
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
1. run the application you need
|
||||
2. wait for its PVs to be created
|
||||
3. suspend the application: `kubectl scale deployment/statefulset/... NAME -n NAMESPACE --replicas=0`
|
||||
4. wait for it to scale down so that the ReadWriteOnce PVs are released (or data-migrate will not be able to mount them)
|
||||
5. look up the destination PVC name you need: `kubectl get pvc NAME -n NAMESPACE`
|
||||
6. put the source host(node) and dir and destination PVC name to `install.yaml`
|
||||
7. install the data-migrate: `kubectl create namespace data-migrate && kubectl delete pod data-migrate -n data-migrate --ignore-not-found=true && kubectl apply -f install.yaml`
|
||||
8. run the migration: `kubectl exec data-migrate -n data-migrate -- cp -a /old/. /new/` or anything you need instead of `cp`
|
||||
9. validate you have everything migrated: `kubectl exec data-migrate -n data-migrate -- ls -laR /new`
|
||||
10. uninstall the data-migrate: `kubectl delete pod data-migrate -n data-migrate`
|
||||
11. resume the application back: `kubectl scale deployment/statefulset/... NAME -n NAMESPACE --replicas=1`
|
||||
@@ -0,0 +1,24 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: data-migrate
|
||||
namespace: data-migrate
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: migrate
|
||||
image: busybox
|
||||
command: ["sleep", "3600"]
|
||||
volumeMounts:
|
||||
- name: old-data
|
||||
mountPath: /old
|
||||
- name: new-data
|
||||
mountPath: /new
|
||||
nodeName: <NODE_NAME_THAT_HAS_DIR_YOU_WANT_TO_MIGRATE_FROM>
|
||||
volumes:
|
||||
- name: old-data
|
||||
hostPath:
|
||||
path: <DIR_YOU_WANT_TO_MIGRATE_FROM>
|
||||
- name: new-data
|
||||
persistentVolumeClaim:
|
||||
claimName: <PVC_YOU_WANT_TO_MIGRATE_TO>
|
||||
Reference in New Issue
Block a user