I can think about two options to fulfill your needs:
- Create a pod with the PV attached to it and use
kubectl cpto copy the contents wherever you need. You could for example use aPodSpecsimilar to the following:
apiVersion: v1
kind: Pod
metadata:
name: dataaccess
spec:
containers:
- name: alpine
image: alpine:latest
command: ['sleep', 'infinity']
volumeMounts:
- name: mypvc
mountPath: /data
volumes:
- name: mypvc
persistentVolumeClaim:
claimName: mypvc
Please note that mypvc should be the name of the PersistentVolumeClaim that is bound to the PV you want to copy data from.
Once the pod is running, you can run something like below to copy the data from any machine that has kubectl configured to connect to your cluster:
kubectl cp dataaccess:/data data/
- Mount the PV’s EBS volume in an EC2 instance and copy the data from there. This case is less simple to explain in detail because it needs a little more context about what you’re trying to achieve.