kubectl to inspect, create, and fix them. We cover:
- Inspecting the initial cluster state
- Creating Deployments (manifest and
kubectlshortcut) - Diagnosing common pod failures like
ErrImagePull/ImagePullBackOff - Best practices and quick reference commands
Initial cluster state — verify there are no resources
Start by confirming the default namespace is empty for Pods, ReplicaSets, and Deployments:Create a Deployment (frontend-deployment) and inspect controller behavior
When you create a Deployment, the Deployment controller creates a ReplicaSet which in turn creates Pods. After creatingfrontend-deployment, inspect each resource:
- Question: How many of the four pods are Ready?
- Answer: 0/4 are Ready (each pod shows
0/1in READY).
- Answer: 0/4 are Ready (each pod shows
busybox888 cannot be found or pulled, causing ErrImagePull and ImagePullBackOff. Fix the image name in the Deployment to a valid image (for example busybox).
Fixing a manifest and creating a Deployment from a file
Assume you have a manifestdeployment-definition-1.yaml in /root:
This error commonly occurs due to typos or incorrect casing in the manifest. Kubernetes resource Kind values are case-sensitive — they must match the API (for example,
Deployment not deployment).kind casing), create it:
busybox888, which will likely fail to pull. Expect ImagePullBackOff / ErrImagePull unless you use a valid image name.
Create a Deployment using kubectl create (name + image)
The shortcutkubectl create deployment simplifies Deployment creation. The --replicas flag may or may not be supported depending on your kubectl version. If it’s not supported, create then scale.
The task: create a Deployment named httpd-frontend using the httpd image with 3 replicas.
Recommended sequence (works in all kubectl versions):
Example (create then scale):
Quick troubleshooting checklist
- If pods show
ErrImagePullorImagePullBackOff, run:kubectl describe pod <pod-name>to see the container image and error reason.kubectl logs <pod-name>for container logs (if any).
- Manifests are case-sensitive for
kindandapiVersion. - Use
kubectl create deployment+kubectl scaleor apply a manifest to set replica counts.
Useful command reference
Summary
- A Deployment manages ReplicaSets, which manage Pods.
- Pods failing to start often indicate image pull problems — verify the image name and registry access.
- Kubernetes manifests are case-sensitive; typos in
kindorapiVersionproduce creation errors. - Use
kubectl create deploymentfor quick setups andkubectl scaleor a manifest to set replica counts.