Action Items: Setting Kubernetes Memory Requests

Learn how Fairwinds Insights helps you set your requests within Kubernetes clusters.


Hi. In this video, we're going to be looking at the Insights action item, memory request should be set. We're going to look at how to find more information about that action item and how to resolve that action item within a cluster. If we look at the Insights console on the bottom right of this screen, you'll see an action item that says memory request should be set. If we click on that, we'll get more information, including the specific object that this is pertaining to. So it's a DaemonSet called prometheus-prometheus-node-exporter. The specific container is node-exporter, the specific container running inside the pod that the DaemonSet are creating.

If you keep scrolling down, you'll see more information about why it's important to set this. In particular, you want to make sure that the container has enough memory to run in the nodes. And I know that if you don't set this, I know this from personal experience, that you may actually have issues, not just with the workload itself but with the node that the workload is running on, so other workloads on that node may be affected by this setting not being here.

If we keep scrolling down, we'll see an example of how to set this within the specification of the workload. So you can see, we have a resources block, a request block, and then we set the memory there.

If we look to see where this is located, we can see the DaemonSet here and see that four pods are running. If I go in to edit the DaemonSet, I look for resources, you'll see that there's an empty resource block here. And just for clarification, you can see that this container that we're looking at is the node-exporter container, which is listed here in the Insights action item.

What should I set this as? Setting resources in Kubernetes can be a challenging task to get right, at least the first time, but one thing we can do is use kubectl top pods to see how many resources this is currently taking up. We can see that it's at 394 megabytes so let's maybe make that about 500 to start and go from there. Let's go back down here and add in memory 500mi. Let's see what's happening. You can see that we're actually going to roll through the pods of the DaemonSet one by one and get that changed. Once that's there, we'll look at one of the pods and make sure that that change has taken place.

Okay. It looks like this one is ready to go. We have memory set as 500 megabytes, and so that's how you address and resolve the memory request should be set action item in Insights. Thanks very much for watching.