Difference between revisions of "Kubectl cp"

From wikieduonline
Jump to navigation Jump to search
Line 11: Line 11:
  
  
[[error: source and destination are required]]
+
 
Solution: remove trailing /* from your local directory name
 
  
  
Line 29: Line 28:
 
  [[kubectl exec myalpine -- df -kh]]
 
  [[kubectl exec myalpine -- df -kh]]
 
  [[mount]] | [[grep ^/dev/]] | grep -v /etc | awk '{print $3}'
 
  [[mount]] | [[grep ^/dev/]] | grep -v /etc | awk '{print $3}'
 +
 +
 +
== Errors ==
 +
 +
[[error: source and destination are required]]
 +
Solution: remove trailing /* from your local directory name
 +
 +
[[error: unable to upgrade connection]]: [[container not found]]("your-container")
 +
  
 
== Related ==
 
== Related ==

Revision as of 12:07, 7 February 2024

kubectl cp
kubectl cp --help
kubectl cp YourRemoteContainer:/yourdestinationdatafolder/ /your/local/folder/
kubectl cp YourNamespace/YourRemoteContainer:/yourdestinationdata/ /your/local/folder/
kubectl cp youfile.txt YourRemoteContainer:/yourdestinationdata
kubectl cp /your/local/folder/* YourRemoteContainer:/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
mount | grep ^/dev/ | grep -v /etc | awk '{print $3}'


Errors

error: source and destination are required
Solution: remove trailing /* from your local directory name 
error: unable to upgrade connection: container not found("your-container")


Related

See also

Advertising: