Up to this point we were working with some of the core Kubernetes building blocks, such as Kubernetes Pods, Kubernetes Deployments and Kubernetes ConfigMaps and Secrets.

These resources, once created, take up some of your Kubernetes platform resources, be it CPU, RAM or Disk Space. Your Kubernetes environment can very quickly spin out of control if you don’t keep an eye on these core resources that you provisioned in this environment.

Therefore, in this final chapter of the Kubernetes Building Blocks series, we’ll learn how to maintain a healthy Kubernetes environment.


Node Status & Health Check

This is probably best place to start when looking into Kubernetes cluster status, including Node’s resources, events and constraints.

More details: Kubernetes Nodes

kubectl describe nodes

CPU & RAM Usage

Knowing which Pods consume most of the CPU and RAM on your Kubernetes cluster will help you contain these resources within its limits. This is very important from a number of reasons, mainly reducing cost by freeing space for the apps that need the resources more. Also performance of you Pods is a key metric here to.

Why is my Pod running high of CPU all the time? Does it need so much RAM etc…

View Node Level CPU & RAM Allocations

kubectl get nodes --no-headers | awk '{print $1}' | xargs -I {} sh -c 'echo {}; kubectl describe node {} | grep Allocated -A 5 | grep -ve Event -ve Allocated -ve percent -ve -- ; echo'

View Pod Level CPU & RAM Allocations

kubectl top pod --all-namespaces

View Horizontal Pod Autoscaler Targets

kubectl get hpa --all-namespaces

Delete Pods

For detailed examples on Pod delete operations please refer back to the Delete section in this article: Kubernetes Pods


Delete Deployments

For detailed examples on Deployment delete or rollback operations please refer back to the Delete section in this article: Kubernetes Deployments


<< Kubernetes ConfigMaps and Secrets | Kubernetes Housekeeping

Marcin Narloch

Marcin Narloch

Creative and out-of-the-box thinker with strong interests and knowledge in technology and innovation.
WordPress GitHub Pages 0 Previous post Adding Google Analytics to Jekyll GitHub Pages
Docker Building Blocks Next post Kubernetes ConfigMaps and Secrets

Leave a Reply

Your email address will not be published.