How do you follow pod logs in real time with kubectl?
kubectl logs -f [pod] — Follow logs
kubectl logs -f [pod] streams the pod's log output until you interrupt it with Ctrl + C. Without -f the command prints the current log and exits; add -n [namespace] when the pod is not in the default namespace.
Related Kubernetes (kubectl) shortcuts: View Resources
| Shortcut | Action | Notes |
|---|---|---|
| kubectl get pods | List pods | List pods in current namespace. |
| kubectl get svc | List services | List services. |
| kubectl get nodes | List nodes | List cluster nodes. |
| kubectl get all | All resources | List all resources. |
| kubectl describe pod [name] | Pod details | Show detailed pod information. |
| kubectl logs [pod] | View logs | View pod logs. |
| kubectl logs -f [pod] | Follow logs | Follow pod logs in real time. |
From the Kubernetes (kubectl) reference (17 entries) · all how-to answers