Skip to main content
This lesson walks through a practical solution for a pods lab. You’ll practice: listing and inspecting pods, creating pods imperatively and declaratively, diagnosing image-pull failures, and updating pod manifests to resolve issues.

How many pods exist on the system?

List pods in the current namespace with:
By default kubectl get pods shows pods in the current namespace. To target a specific namespace use -n <namespace>. To list pods across all namespaces use --all-namespaces.
If no pods exist you’ll see:

Task: Create a new pod using the nginx image

To create a bare Pod object for a single container image you can use kubectl run. Note: on newer kubectl versions kubectl run defaults to creating a Deployment unless you specify --restart=Never.
A minimal example to create a pod:
Example session creating the nginx pod:
Check the pod list:
In this example there are four pods: nginx, newpods-llstt, newpods-pnnx8, and newpods-k87fx.
Important: In many kubectl versions kubectl run <name> --image=<image> will create a Deployment by default. Use --restart=Never to create a single Pod instead. If you intend to manage manifests declaratively, consider generating YAML with --dry-run=client -o yaml and then kubectl apply.

Inspect a pod to determine the image used

Use kubectl describe pod <pod-name> to get detailed pod metadata, container images, status, and events. Example:
From the Containers: section you can see the image used for each container — in this example the container image is busybox.

Which node are the new pods placed on?

To determine the node a pod is scheduled on:
  • Use kubectl describe pod <pod> and check the Node: field, or
  • Use kubectl get pods -o wide to include the NODE column.
The NODE column shows the node on which each pod is scheduled. In the examples above the pods were scheduled on the controlplane node.

How many containers are part of the pod webapp?

The READY column in kubectl get pods shows “ready containers / total containers”. For container-level details, run:
Example excerpt showing two containers (nginx and agentx):
From this output you can conclude webapp has two containers (nginx and agentx). Quick reference table for interpreting the READY column:

What is the state of the container agentx in the pod webapp and why?

The agentx container shows State: Waiting with Reason: ErrImagePull. The Events section from kubectl describe provides more context:
The failure message indicates Docker Hub does not have an image named agentx (or the image requires authentication). As a result, the kubelet cannot pull the image and the container stays in a waiting/error state.

What does the READY column in kubectl get pods indicate?

READY indicates how many containers in the pod are currently ready vs. the total number of containers in that pod. Use it for a quick health indicator. Examples:
  • 1/1 — single container, it is ready.
  • 1/2 — pod has two containers, one is ready and one is not.

Delete the webapp pod

To delete the pod:

Create a new pod named redis with the image redis123 (intentional invalid image)

You can create a pod imperatively with kubectl run, or generate a pod manifest with --dry-run=client -o yaml and apply it later. (Note: --dry-run without a value is deprecated; use --dry-run=client.)
Use --dry-run=client to generate the resource manifest without creating it. Redirect the output to a YAML file to edit before applying.
Generate a YAML manifest (this manifest intentionally uses a wrong image name redis123):
Save this output to redis.yaml, then create the pod:
Because redis123 does not exist on the registry, the pod will fail to pull the image and enter a state such as ImagePullBackOff.

Fix the pod by changing the image to redis

You can fix the manifest by editing the YAML and re-applying it, or use kubectl edit pod redis to change the image in-place (note: editing a running pod may be limited — manifests are generally managed declaratively). Corrected YAML (image set to redis):
Apply the corrected manifest:
Verify the pod is running:

Common pod debugging commands


This completes the lab solution for pods. You practiced listing pods, inspecting details with kubectl describe, interpreting READY and event messages, creating pods both imperatively and declaratively, diagnosing image-pull failures, and updating a pod manifest to fix a broken image reference. Links and references

Watch Video