Skip to content

Instantly share code, notes, and snippets.

@nasa9084
Created October 25, 2018 07:26
Show Gist options
  • Save nasa9084/9c175a20c8183071dd188362277a66c5 to your computer and use it in GitHub Desktop.
Save nasa9084/9c175a20c8183071dd188362277a66c5 to your computer and use it in GitHub Desktop.
  1. create a new PersistentVolumeClaim
  2. create migration Pod
---
apiVersion: v1
kind: Pod
metadata:
  name: migrate
spec:
  containers:
    - name: migrate
      image: centos:7
      volumeMounts:
        - name: from
          mountPath: /from
        - name: to
          mountPath: /to
      command:
        - sleep
        - 2h
  volumes:
    - name: from
      persistentVolumeClaim:
        claimName: <PERSISTENT_VOLUME_MIGRATE_FROM>
    - name: to
      persistentVolumeClaim:
        claimName: <PERSISTENT_VOLUME_MIGRATE_TO>
  1. kubectl exec migrate -- cp -r /from /to
  2. delete migration Pod
  3. configure your Deployment to use new PersistentVolumeClaim
  4. check new Deployment is running successfully
  5. delete old PersistentVolumeClaim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment