kubernetes – One-off kubectl run with file

I would like to execute a one-off in a Kubernetes cluster, however using a file from the local file system. Something like:

kubectl run mytmpjob --rm --restart="Never" \
  --command <some-command-which-acts-on-a-file-uploaded-from-local>

I like the convenience that kubectl run --rm gives me since this is a one-off.

It seems to me that I need a combination of kubectl cp and kubectl run but I cannot see how? How do I get the file into the container when it doesn’t exist until the point of the kubectl run command?

Read more here: Source link