What is the difference between `kubectl logs --previous` and `kubectl logs -f`?
BeginnerProductionObservability & Day-2 Operations
Answer
--previous prints logs from the last terminated instance of the container (essential for CrashLoopBackOff), -f streams the current instance. Use --since, --tail, -c for containers, and -l app=web --prefix to read many Pods.
kubectl logs -l app=web --prefix --since=15m --max-log-requests=20
More on Observability & Day-2 Operations
What are the three pillars of observability and the standard tools on Kubernetes?BeginnerWhat is kube-state-metrics and how does it differ from metrics-server?BeginnerWhich alerts do you set up first on a cluster?BeginnerWhere do container logs live and how do you ship them?BeginnerWhat does a good runbook for a Kubernetes alert include?BeginnerHow do you collect cluster events and why?Beginner