learning kubernetes from 0, Trying to find the difference between adding the --command flag to nod adding it to this command.
kubectl run busybox --image=busybox --command --restart=Never -- envVS
kubectl run busybox --image=busybox --restart=Never -- envpretty much both worked for me, what am i missing ?
Wrote the output to yaml:
With --command :
- command:
- env
image: busybox
name: busybox1Without --command :
- args:
- env
image: busybox
name: busyboxwhat is the difference between args and command ?
You can always look up by
kubectl run -hStart the nginx container using the default command (i.e command defined in Docker container manifest) , but use custom arguments (arg1 .. argN) for that command.
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>Start the nginx container using a different command and custom arguments.
kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>If we compare with Docker:
Docker's ENTRYPOINT - executable invoked when the container is executed - maps to command in Kubernetes
Docker's CMD - arguments that get passed to the ENTRYPOINT maps to args - in Kubernetes
In your case it does not make any difference because you are not specifying any command actually (i.e. should be --command ls for example.