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.Task: Create a new pod using the nginx image
To create a bare Pod object for a single container image you can usekubectl run. Note: on newer kubectl versions kubectl run defaults to creating a Deployment unless you specify --restart=Never.
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
Usekubectl describe pod <pod-name> to get detailed pod metadata, container images, status, and events.
Example:
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 theNode:field, or - Use
kubectl get pods -o wideto include theNODEcolumn.
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:
nginx and agentx):
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:
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.redis123):
redis.yaml, then create the pod:
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):
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