Local files transfered to a Kubernentes Persistent Volume?

11/6/2017

I'm extremely new to Kubernetes (besides it's not my field) but I got required to be able to execute this practice.

Question is that I need a Handbrake Converter in a containerized pod with a Persistent Volume mounted on a GKE cluster:

  • 3 nodes.
  • node version 1.8.1-gke.1
  • node image Ubuntu

Everything is fine until this point but now I'm not able to upload a folder to that PV from my local machine.

What I have tried is a ssh connection to the node and then a sudo docker exec -ti containerId bash but I just got rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"bash\\\": executable file not found in $PATH\"\n".

Thanks in advance.

-- Cristobal Romero Fernandez
docker
file-upload
google-kubernetes-engine
kubernetes
persistent-volumes

1 Answer

11/6/2017

To transfer local files to a kubernetes pod, use kubectl cp:

kubectl cp my-namepace/my-pod:/root/my-local-file -c my-container ./my-remote-location

For SSH'ing you need to go through kubectl as well:

kubectl exec -it <podname> -- /bin/sh
-- vascop
Source: StackOverflow