Logs and Exec
Fetch logs
Applications should log to stdout/stderr so kubectl can stream them.
kubectl logs deploy/web
kubectl logs deploy/web --tail=100 -f
Pick a pod by name
When multiple replicas exist, target one pod explicitly.
kubectl get pods
kubectl logs web-7d9f8c-abc12
Exec into a container
Interactive debugging shell (image must include a shell).
kubectl exec -it deploy/web -- sh
Prefer durable fixes
Exec is temporary. Fix images, probes, config, or resource requests so the next pod starts healthy without manual steps.
Comments
One comment per signed-in account. Comments are saved with this page’s URL.