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

CommandWhat it does
kubectl get pods -AAll pods in all namespaces
kubectl describe pod <name>Events, probes, and scheduling details
kubectl logs <pod> -c <container> --tail=100Logs of one container
kubectl exec -it <pod> -- shShell 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