Monitor Kubernetes Pod Status & Resources with kubectl
How to Monitor Kubernetes Pod Status and Resources on Linux Server
Getting "No resources found" from kubectl get pods? See kubectl get pods: No resources found - causes and fixes.
Monitor Kubernetes pod status and resources to track pod health, detect failures, and optimize resource allocation. This guide shows you how to monitor pods and set up automated monitoring.
For comprehensive Kubernetes monitoring, see Kubernetes Monitoring. For troubleshooting pod issues, see Docker Container Crash Restart Loop.
Why Monitoring Pod Status Matters
Kubernetes pod monitoring helps identify pod failures, resource exhaustion, and performance issues. Monitoring pod status ensures reliable containerized applications and optimal resource utilization.
Method 1: Check Pod Status with kubectl
List Pod Status
# List all pods
kubectl get pods
# Get pod status details
kubectl get pods -o wide
# Check pod status in namespace
kubectl get pods -n <namespace>
# Get pod details
kubectl describe pod <pod-name>
# Check pod status with custom format
kubectl get pods -o custom-columns=NAME:.metadata.name,STATUS:.status.phase,RESTARTS:.status.containerStatuses[0].restartCount
Monitor Pod Resources
# Get pod resource usage
kubectl top pods
# Get pod resource usage in namespace
kubectl top pods -n <namespace>
# Get node resource usage
kubectl top nodes
# Get detailed resource metrics
kubectl get --raw /apis/metrics.k8s.io/v1beta1/pods
Method 2: Check Pod Restart Status
Monitor Pod Restarts
# List pods with restart count
kubectl get pods -o custom-columns=NAME:.metadata.name,RESTARTS:.status.containerStatuses[0].restartCount,STATUS:.status.phase
# Find pods with high restart count
kubectl get pods --field-selector=status.phase=Running -o json | jq '.items[] | select(.status.containerStatuses[0].restartCount > 3) | .metadata.name'
# Check pod restart history
kubectl get pod <pod-name> -o jsonpath='{.status.containerStatuses[0].restartCount}'
Method 3: Automated Pod Monitoring with Zuzia.app
Manual checks work while you are looking. To keep running them without you, Zuzia uses its agent and scheduled tasks.
How it works in Zuzia
- Install the Zuzia agent on the server with one command. CPU, RAM, disk, load and network metrics start reporting on their own, with alerts on a threshold, on drift from the server's normal, or on a disk fill-up forecast.
- Save the commands from this guide as a scheduled task and choose how often it runs, from every minute to once a year. The agent runs it on every host you pick.
- If a command fails, you get an alert right away by email, Slack, Discord, push (through your Pushover account) or SMS (through your Vonage account).
- The output of every run is kept, so you can look back at what changed. On paid plans, AI can read the output and alert you only when it spots a problem.
Setting it up
- Add the server in the Zuzia dashboard and install the agent.
- Create a scheduled task with the check commands below, then choose the hosts and how often it runs.
- Choose your notification channels. Turn on maintenance mode during planned work so it doesn't trigger alerts.
Best Practices for Pod Monitoring
1. Monitor All Pods Continuously
- Track pod status for all namespaces
- Monitor pod restart counts
- Alert when pods fail
- Ensure sufficient pod replicas
2. Monitor Pod Resources
- Track CPU and memory usage per pod
- Alert when resources exceed thresholds
- Monitor resource trends over time
- Optimize resource allocation
3. Set Up Comprehensive Alerts
- Configure alerts for pod failures
- Set up alerts for resource exhaustion
- Monitor pod restart frequency
- Alert on deployment issues
4. Track Pod Trends
- Review pod performance trends weekly
- Identify pod failure patterns
- Optimize resource allocation based on trends
- Correlate pod issues with application changes
Troubleshooting Pod Issues
Step 1: Identify Pod Problems
When pods have issues:
# Check pod status
kubectl get pods
# View pod events
kubectl describe pod <pod-name>
# Check pod logs
kubectl logs <pod-name>
# Check pod resource usage
kubectl top pod <pod-name>
Step 2: Resolve Pod Issues
Based on investigation:
Fix Pod Failures:
- Restart failed pods
- Fix application bugs
- Update pod configuration
Optimize Pod Resources:
- Adjust resource requests and limits
- Optimize pod configuration
- Scale pods if needed
FAQ: Common Questions About Pod Monitoring
How often should I check pod status?
For production Kubernetes clusters, continuous automated monitoring is essential. Zuzia.app can check pod status every few minutes, storing historical data and alerting you when pods fail.
What should I monitor for pods?
Monitor pod status, pod resource usage (CPU and memory), pod restart counts, pod availability, and deployment status. Focus on metrics that impact application availability and performance.
How do I monitor pods across multiple clusters?
Zuzia.app allows you to monitor Kubernetes clusters across multiple environments from one centralized dashboard. Each cluster executes monitoring commands independently, and all results are stored for centralized analysis.
Can pod monitoring impact cluster performance?
Pod monitoring commands have minimal impact on cluster performance when done correctly. Use appropriate monitoring frequency and ensure monitoring doesn't interfere with application workloads.
Related guides, recipes, and problems
Related guides
guides--monitoring-container-orchestration-kubernetes.mdguides--monitoring-docker-containers-production.md
Related recipes
recipes--monitor-docker-container-resource-usage.mdrecipes--how-to-check-docker-containers-running.md
Related problems
problems--docker-container-crash-restart-loop.mdproblems--service-keeps-stopping-restarting.md