Action Items: Setting Kubernetes CPU Requests

Learn how Fairwinds Insights helps you set your CPU requests.


Hello, everybody. Today, I'm going to tell you what you can do to resolve the action item, CPU requests should be set. On the right hand side, we see here the Fairwinds Insights UI, and it says that CPU requests should be set. It's going to give me a lot of information about what workload it needs to be set on, as well as a description, and some links to documentation, and then also an example of how we would set resource requests in our application.

What I'm going to do is, I'm going to find where I've defined this application. So I know that this is a statefulset named argocd-redis-ha-server in the namespace, argocd, and the container name is redis. If we look here on the left, we're going to see I'm connected to a Kubernetes cluster, and we're also going to see that I'm in a manifest directory, it's an Argo CD manifest directory. It doesn't matter how you're applying your YAML, but somewhere YAML is going to get generated and that's what's going to define your object.

We actually see right here, at the bottom, that we have the statefulset, argocd-redis-ha-server. And I'm pretty sure that's going to define the statefulset, argocd-redis-ha-server. I’m going to take a look at that YAML and I'm going to edit it. We're going to go all the way down here to where containers are defined. And let's see, this first container name is redis, great. That's the one we're looking for because we said the container name here is redis. And if we scroll down, we're going to see there is no resource block defined for this application.

I'm going to go ahead and do is, anywhere at this top level of the container's YAML, I'm going to add resources and real quick, I'm going to scroll down on the action line itself and we're going to look back at that YAML block. I'm going to see resources and then requests. And I'm going to say CPU, 250m, but now I realize that maybe that's not quite the right place to start.

Let’s just take a quick look at the actual resource requests or the actual resource usage in the Argo CD namespace. And I'm going to search for argocd-redis-ha-server and let's take a look at what the actual current CPU usage is. And we take a look and we see it's using less than 10 milicores. So maybe 250 is a little bit aggressive. So I'm going to go back in here to my spec and I'm going to go find that resources block with the requests. And I'm just going to set that to a 100 milicores. It's probably a little bit more than I need, but for now I want to just make sure we've got plenty of space to run that thing and because it's a production service, I don't want to mess it up too bad.

Now I've added that resource block to my YAML. What I'm going to do, in this case, is make a pull request and my GitOps controller is going to apply it. Anyway that you apply YAML to the cluster, go ahead and apply it and we've resolved the action item CPU requests should be set. Thanks y'all.