DevOpsGeek
DevOpsGeek

Reputation: 322

Understanding kubectl run command

I am tryng to create a pod using kubectl run by creating an yaml file, where first command is creating container but showing state as error and second one is creating with out any issue. what is the difference between these commands?

master $  kubectl run --restart=Never --image=busybox static-busybox --command -- sleep 1000 --dry-run -o yaml //Error container

master $  kubectl run --restart=Never --image=busybox static-busybox --dry-run -o yaml --command -- sleep 1000 //working command

Upvotes: 0

Views: 760

Answers (2)

SmasherHell
SmasherHell

Reputation: 884

In the first one parameters --dry-run -o yaml are applied to the command you run in the container (sleep), in the second one, they are applied to your kubectl execution

Upvotes: 2

Arghya Sadhu
Arghya Sadhu

Reputation: 44687

As per the syntax of the kubectl run command needs to be at the end. That's precisely the reason why first command is not working but second one is working.

Usage:
  kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json]
[--command] -- [COMMAND] [args...] [options]

Upvotes: 1

Related Questions