run

Using run command

Create and run a particular image in a pod. Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.

Command

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

Example

Command

kubectl run nginx --image=nginx

Output

$ kubectl get pods

NAME                     READY   STATUS    RESTARTS   AGE
nginx-6db489d4b7-tsfhq   1/1     Running   0          28s

$ kubectl get deployment

NAME    READY   UP-TO-DATE   AVAILABLE   AGE
nginx   1/1     1            1           44s


Last modified September 23, 2020: docs update (b46eb86)