Getting Started with Kubernetes: Essential Commands
Good to know commands help you on the way
Are you diving into the world of Kubernetes and looking for some basic commands to kickstart your journey? Well, you're in the right place! In this post, we'll cover a few fundamental commands that will help you navigate and monitor your Kubernetes environment more efficiently.
Checking Pod Logs in Real-time
Understanding what's happening inside your pods is crucial. To stream pod logs, use the following command:
kubectl logs <pod_name> -n <namespace_name> -f
Managing Docker Disk Space
Keeping an eye on your Docker disk space is essential, especially in a collaborative environment. Use the following command to check disk space used by local Docker images:
docker system df
In case your build cache is taking up too much space, consider using:
docker builder prune
On RHEL systems, Docker images are typically located here:
du -sh /var/lib/docker/*
Monitoring Kubernetes Namespace Quota
Ensure you're within your Kubernetes namespace quota by using:
kubectl describe quota -n <namespace_name>
Listing Running Pods
Need to see all the currently running pods in your namespace? Execute:
kubectl get pods -n <namespace_name>
Bonus Tip: Watching Pod Activity in Real-time
For a real-time overview of pod activities, including terminations and new starts, use:
kubectl get pods -n <namespace_name> -w
I hope these commands simplify your Kubernetes journey. Feel free to let me know if you found this helpful or if you have any questions. Happy coding!