kubectl logs
DebuggingPrint container logs
Options & Flags
Available options for this command
-fFollow log output
-cContainer name (for multi-container pods)
--tailNumber of lines to show
--sinceOnly show logs since duration
-pShow previous container logs
Examples
Common usage examples
Get pod logs
kubectl logs mypodFollow logs in real-time
kubectl logs -f mypodLogs from specific container
kubectl logs mypod -c mycontainerLast 100 lines
kubectl logs mypod --tail=100Logs from last hour
kubectl logs mypod --since=1hLogs from pods with label
kubectl logs -l app=nginxNotes
- Use -p to view logs from crashed container
Related Commands
You might also find these useful