📋 POD Lifecycle in Kubernetes
- 📝 Pod Request: A request is made to the API server using a local pod definition YAML.
- 📦 Persistence: The API server saves the pod info in etcd (the key-value store).
- 🧽 Scheduling: The Scheduler identifies unscheduled pods and assigns them to suitable nodes.
- ⚙️ Kubelet Reaction: The kubelet on the node notices the scheduled pod and starts the container runtime.
- 🐳 Container Startup: The container runtime (e.g., Docker or containerd) starts the container.
- 🧠 State Management: The lifecycle state of the pod is stored and updated in etcd throughout its lifecycle.
🎯 POD Statuses and Their Meaning
Status | Description | Possible Reasons |
---|---|---|
🟡 Pending | Pod has been accepted but not yet running. | Image pulling, scheduling delay, insufficient resources |
🟢 Running | Pod is bound to a node and all containers are running or starting. | Everything is healthy and operational |
🔄 Succeeded | All containers in the pod terminated successfully. | For short-lived jobs (e.g., kubectl run ) |
❌ Failed | All containers terminated, and at least one failed. | Container error, non-zero exit status |
🔁 CrashLoopBackOff | Container fails, restarts repeatedly. | App crashing, misconfiguration, missing env variables |
🔍 ImagePullBackOff | Kubernetes can't pull the container image. | Wrong image name, missing credentials, image doesn't exist |
⛔ ErrImagePull | Kubernetes is currently unable to pull the container image. | Temporary network issues, image not found, registry issue |
❌ Unknown | Node communication failure, status can't be determined. | Node is unreachable, network partition |
🔎 Investigating Pod Issues
📄 Describe the Pod
kubectl describe pod <PodName> [-n <namespace>] [--show-events] [--kubeconfig <file>] [--context <name>]
📜 View Pod Logs
kubectl logs <PodName> [-n <namespace>] [-c <container_name>] [--previous] [--timestamps] [--tail=<lines>] [--since=<duration>] [--follow] [--limit-bytes=<bytes>]
Let me know if you want code snippets or diagrams added as well! 🚀