Kubectl Pods
Inspect pods, describe failures, and get a shell inside.
- kubectl pods
- describe pod
- kubectl logs
- kubectl exec
- pod pending
Kubectl Pods
Inspect pods, describe failures, and get a shell inside.
Commands
| Command | What it does |
|---|---|
kubectl get pods -A | All pods in all namespaces |
kubectl describe pod <name> | Events, probes, and scheduling details |
kubectl logs <pod> -c <container> --tail=100 | Logs of one container |
kubectl exec -it <pod> -- sh | Shell into a pod |
kubectl delete pod <name> | Delete (controller recreates it) |
Example
kubectl get pods -n shop
kubectl describe pod api-7d9c5f6b9-abcde -n shop
kubectl logs api-7d9c5f6b9-abcde -n shop --tail=100
FAQ
Pod stuck in Pending?
describe shows the cause: unschedulable resources, missing PVC, or image pull errors — read Events bottom-up.
Should I delete pods to restart them?
Yes for quick restarts, but fix the Deployment (or rollout restart) for a durable, auditable change.
الأسئلة الشائعة
Pod stuck in Pending?
describe shows the cause: unschedulable resources, missing PVC, or image pull errors — read Events bottom-up.
Should I delete pods to restart them?
Yes for quick restarts, but fix the Deployment (or rollout restart) for a durable, auditable change.
Kubernetes
Kubectl Config and Context
Point kubectl at the right cluster and switch contexts safely.
Kubectl Deployments
Create, update, and inspect Deployments that own your pods.
Kubectl Services
Expose pods stably with ClusterIP, NodePort, and LoadBalancer.
Kubectl Ingress
Route external HTTP traffic to services by host and path.