Dive Deep Into Resource Requests and Limits in Kubernetes

As you create resources in a Kubernetes cluster, you may have encountered the following scenarios:

  1. No CPU requests or low CPU requests specified for workloads, which means more Pods “seem” to be able to work on the same node. During traffic bursts, your CPU is maxed out with a longer delay while some of your machines may have a CPU soft lockup.
  2. Likewise, no memory requests or low memory requests specified for workloads. Some Pods, especially those running Java business apps, will keep restarting while they can actually run normally in local tests.
  3. In a Kubernetes cluster, workloads are usually not scheduled evenly across nodes. In most cases, in particular, memory resources are unevenly distributed, which means some nodes can see much higher memory utilization than other nodes. As the de facto standard in container orchestration, Kubernetes should have an effective scheduler that ensures the even distribution of resources. But, is it really the case?

Generally, cluster administrators can do nothing but restart the cluster if the above issues happen amid traffic bursts when all of your machines hang and SSH login fails. In this article, we will dive deep into Kubernetes requests and limits by analyzing possible issues and discussing the best practices for them. If you are also interested in the underlying mechanism, you can also find the analysis from the perspective of source code. Hopefully, this article will be helpful for you to understand how Kubernetes requests and limits work, and why they can work in the expected way.

Open-Source Java Library With Stack Trace Filtering, Silent String Parsing, and Version Comparison

Over some time in different jobs, I came across a need for several utilities that I couldn't find available at the time. And I saw that I needed them several times over. So, I wrote my own small library that I found very useful. I just published it as an open-source Java library. Here is the link. Additionally, and the Javadoc is available here.

This library is also available on Maven Central. Here are the Maven artifacts (version 1.5.0.6 is the latest at the time of writing this article but might change. You can check for the latest version search for artifact " MgntUtils" at http://search.maven.org/):