How to start a pod in command line without deployment in kubernetes?
kubectl run nginx --image=nginx --port=80 --restart=Never
--restart=Always
: The restart policy for this Pod. Legal values [Always
,OnFailure
,Never
]. If set toAlways
a deployment is created, if set toOnFailure
a job is created, if set toNever
, a regular pod is created. For the latter two--replicas
must be1
. DefaultAlways
[...]
see official document https://kubernetes.io/docs/user-guide/kubectl-conventions/#generators
Now there are two ways one can create pod through command line.
kubectl run nginx --image=nginx --restart=Never
OR
kubectl run --generator=run-pod/v1 nginx1 --image=nginx
See official documentation. https://kubernetes.io/docs/reference/kubectl/conventions/#generators