kubectl: `kubectl run` does not fail when you do not pass a NAME, when you pass a --command

What happened:

$ kubectl run --image fedora --command -- sleep 100
pod/sleep created

the pod is created, then crashloops with

container create failed: time="2020-10-02T16:28:22Z" level=error msg="container_linux.go:366: starting container process caused: exec: \"100\": executable file not found in $PATH"

this should instead error w/ the msg,

error: NAME is required for run
See 'kubectl run -h' for help and examples

How to reproduce it (as minimally and precisely as possible): $ kubectl run --image fedora --command -- sleep 100 the pod/sleep is created, and if you kubectl get pod/sleep -o yaml you’ll see the error noted above.

Environment: latest master build

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (13 by maintainers)

Most upvoted comments

checked out: https://github.com/kubernetes/kubernetes/pull/94290 since it looks related, and the issue is still there, i’ll look closer & open a pr