Command
kubectl get deploymentsExplanation
The 'kubectl get deployments' command displays all deployment resources within a namespace. It provides an overview including the desired, current, and available replica counts. This is essential for monitoring application rollouts, scaling operations, and ensuring deployment stability. Use '-o wide' or '-o yaml' for more structured output.
Common Use Cases
- •Monitor deployment health and readiness
- •Confirm if scaling or rolling updates succeeded
- •Quickly view all deployed applications in a namespace
Best Practices
- ✓Use labels and selectors to filter deployments for specific applications
- ✓Pipe output into 'grep' or 'jq' for quick automation and reporting
Common Mistakes to Avoid
- ⚠Assuming all replicas are running just because deployment shows 'AVAILABLE' — verify pods too
- ⚠Forgetting to specify the namespace when querying deployments across environments
Troubleshooting
Problem: Deployment shows fewer available replicas than desired
Solution: Check pod status with 'kubectl get pods' or describe the deployment for event logs.
Examples
List all deployments in the current namespace
kubectl get deploymentsList deployments with detailed information
kubectl get deployments -o wide