According to the Kubernetes docs, you can start a debug version of a container and run a command on it like this:
$ kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]
But when I try and do this in real life I get the following:
$ kubectl debug mypod
--copy-to=mypod-dev
--env='PYTHONPATH="/my_app"'
--set-image=mycontainer=myimage:dev -- python do_the_debugging.py
error: you must specify an existing container or a new image when specifying args.
If I don't specify -- python do_the_debugging.py
I can create the debug container, but then I need a separate command to actually do the debugging:
kubectl exec -it mypod-dev -- python do_the_debugging.py
Why can't I do this all in one line as the docs seem to specify?
Some kubernetes details:
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.1", GitCommit:"c4d752765b3bbac2237bf87cf0b1c2e307844666", GitTreeState:"clean", BuildDate:"2020-12-23T02:22:53Z", GoVersion:"go1.15.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.15-eks-ad4801", GitCommit:"ad4801fd44fe0f125c8d13f1b1d4827e8884476d", GitTreeState:"clean", BuildDate:"2020-10-20T23:27:12Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…