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
  • 2,063
  • 3
  • 15
  • 26
yasin lachini
  • 5,188
  • 6
  • 33
  • 56

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,738
  • 4
  • 28
  • 42
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
  • 371
  • 4
  • 9