0

I want to copy a file from my Ubuntu machine to kube-controller-manager-ubuntu container. Currently I do that like this, but I think it has more straight solution in Kubernetes.

Does anyone know how to copy a file to a Kubernetes container?

char
  • 1,918
  • 3
  • 15
  • 22
yasin lachini
  • 3,936
  • 3
  • 23
  • 48

2 Answers2

2

it is similar to docker copy.

kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir

Please refer here for examples and documentation

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#cp

Prateek Jain
  • 2,297
  • 3
  • 26
  • 38
1

In case you are using namespace then you wanna go like this -

kubectl cp ./file.csv <CONTAINER_ID>:/path/to/copy -n <namespace>

e.g.

kubectl ./file.csv b81dd0b1745c:/usr/cloud_ms/ -n cloud
mds404
  • 321
  • 3
  • 7