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.

Important

run command is deprecated

Command

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

Example

Command

  1. kubectl run nginx --image=nginx

Output

  1. $ kubectl get pods
  2. NAME READY STATUS RESTARTS AGE
  3. nginx-6db489d4b7-tsfhq 1/1 Running 0 28s
  4. $ kubectl get deployment
  5. NAME READY UP-TO-DATE AVAILABLE AGE
  6. nginx 1/1 1 1 44s