2

I am currently trying to use the "--overrides" option in k8s to mount a local directory that a docker container can access and then run a command against that container utilizing that directory.

kubectl run -i --tty cic-v1 --image=image1 --restart=Never --overrides={"spec":{"volumeMounts":[{"name":"input","mountPath":"/usr/src/data/input"},{"name":"output","mountPath":"/usr/src/data/output"}],"volumes":[{"name":"input","hostPath":{"path":"/input/"}},{"name":"output","hostPath":{"path":"/output/"}}]}}

Ideally this is done inline without the use of a .yaml file. All attempts result in... error: Invalid JSON Patch ...and I am having difficulty debugging this. Has anyone accomplished anything similar?

phnx0023
  • 41
  • 4
  • Would https://stackoverflow.com/a/37621761/6309 help? – VonC Apr 27 '18 at 19:39
  • @VonC Thank you. Yes this does help. Did not intend to duplicate a question. – phnx0023 May 02 '18 at 22:11
  • Great! You can publish here an answer suited for your specific case, inspired by that other question. And you can accept your own answer. – VonC May 02 '18 at 22:24
  • Possible duplicate of [Create kubernetes pod with volume using kubectl run](https://stackoverflow.com/questions/37555281/create-kubernetes-pod-with-volume-using-kubectl-run) – divibisan Aug 20 '18 at 21:30

1 Answers1

1

Answer found here.

https://stackoverflow.com/a/37621761/6309

I was incorrectly specifying the 'overrides' option in k8s.

phnx0023
  • 41
  • 4