How to Check Pod Events in Kubernetes Quickly
Use the
kubectl describe pod [pod-name] command to see detailed events related to a pod. Alternatively, use kubectl get events --field-selector involvedObject.name=[pod-name] to filter events specifically for that pod.Syntax
The main commands to check pod events are:
kubectl describe pod [pod-name]: Shows detailed pod info including recent events.kubectl get events --field-selector involvedObject.name=[pod-name]: Lists only events related to the specified pod.
Replace [pod-name] with your actual pod's name.
bash
kubectl describe pod [pod-name] kubectl get events --field-selector involvedObject.name=[pod-name]
Example
This example shows how to check events for a pod named my-app-pod. It demonstrates both commands and their outputs.
bash
kubectl describe pod my-app-pod kubectl get events --field-selector involvedObject.name=my-app-pod
Output
Name: my-app-pod
Namespace: default
Node: node-1/192.168.1.10
Start Time: Thu, 01 Jun 2023 10:00:00 +0000
Labels: app=my-app
Status: Running
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 5m default-scheduler Successfully assigned default/my-app-pod to node-1
Normal Pulled 4m kubelet Container image pulled
Normal Created 4m kubelet Created container my-app-container
Normal Started 4m kubelet Started container my-app-container
LAST SEEN TYPE REASON OBJECT MESSAGE
1m Normal Pulled Pod/my-app-pod Container image pulled
1m Normal Created Pod/my-app-pod Created container my-app-container
1m Normal Started Pod/my-app-pod Started container my-app-container
Common Pitfalls
Common mistakes when checking pod events include:
- Using the wrong pod name or namespace, which returns no events.
- Not specifying the namespace if the pod is not in the default namespace.
- Confusing
kubectl get eventsoutput because it shows events for all objects unless filtered.
Always verify the pod name and namespace before running commands.
bash
kubectl get events --field-selector involvedObject.name=wrong-pod-name # Correct usage with namespace kubectl get events --namespace=my-namespace --field-selector involvedObject.name=my-app-pod
Quick Reference
Summary tips for checking pod events:
- Use
kubectl describe pod [pod-name]for a quick overview including events. - Use
kubectl get events --field-selector involvedObject.name=[pod-name]to see only pod-specific events. - Always specify
--namespaceif your pod is not in the default namespace. - Check event timestamps to understand recent changes or issues.
Key Takeaways
Use kubectl describe pod [pod-name] to see pod details and events together.
Filter events for a pod with kubectl get events --field-selector involvedObject.name=[pod-name].
Always confirm the pod name and namespace to avoid empty results.
Events help diagnose pod scheduling, image pulling, and container start issues.
Check event timestamps to track recent pod activity and problems.