Difference between revisions of "Kubectl cp"

From wikieduonline
Jump to navigation Jump to search
Line 8: Line 8:
  
 
https://stackoverflow.com/questions/50375826/kubernetes-how-to-download-a-persistentvolumes-content
 
https://stackoverflow.com/questions/50375826/kubernetes-how-to-download-a-persistentvolumes-content
  apiVersion: v1
+
  {{alpine cp example}}
kind: Pod
 
metadata:
 
  name: myalpinedataaccess
 
spec:
 
  containers:
 
  - name: alpine
 
    image: alpine:latest
 
    command: ['sleep', 'infinity']
 
    [[volumeMounts:]]
 
    - name: mypvc
 
      [[mountPath:]] /data
 
  volumes:
 
  - name: mypvc
 
    persistentVolumeClaim:
 
      claimName: mypvctocopy
 
  
 
  kubectl cp myalpinedataaccess:/data data/
 
  kubectl cp myalpinedataaccess:/data data/

Revision as of 23:00, 23 October 2023

kubectl cp
kubectl cp youfile.txt remotepod:/yourdestinationdata
kubectl apply -f

https://stackoverflow.com/questions/50375826/kubernetes-how-to-download-a-persistentvolumes-content

 apiVersion: v1
kind: Pod
metadata:
  name: myalpinewithvolume
spec:
  containers:
  - name: alpine
    image: alpine:latest
    command: ['ash']
    tty: true
    stdin: true
    volumeMounts:
    - name: myvolume
      mountPath: /myvolume
  volumes:
  - name: myvolume
    persistentVolumeClaim:
      claimName: myPVCtoMount
kubectl cp myalpinedataaccess:/data data/
tar: removing leading '/' from member names


kubectl exec <pod_name> -- ls -la /


kubectl exec myalpine -- df -kh

See also

Advertising: