Your JSON redefinition is incorrect. Unfortunately, kubectl works, it simply ignores fields that it does not understand.
kubectl run -i --rm --tty ubuntu --overrides=' { "apiVersion": "batch/v1", "spec": { "template": { "spec": { "containers": [ { "name": "ubuntu", "image": "ubuntu:14.04", "args": [ "bash" ], "stdin": true, "stdinOnce": true, "tty": true, "volumeMounts": [{ "mountPath": "/home/store", "name": "store" }] } ], "volumes": [{ "name":"store", "emptyDir":{} }] } } } } ' --image=ubuntu:14.04 --restart=Never -- bash
To debug this problem, I ran the command you specified, and then in another terminal:
kubectl get job ubuntu -o json
From there, you can see that the actual structure of the work is different from your json override (you lack a nested template / specification, and volumes, volumes and containers must be arrays).
Tim allclair
source share