How to see Openshift total available resources

565 Views Asked by At

I would like to see total available resources for namespace on openshift.

I can see (and calculate) requested and limits for my pods, but how to see how much in total is available for specific namespace (If I am not cluster admin, and if I am cluster admin).

I need this to set resources limit and requsted for my deployment. But not been able to find answer on openshift console or cli.

1

There are 1 best solutions below

0
David Ogren On

I can see (and calculate) requested and limits for my pods, but how to see how much in total is available for specific namespace (If I am not cluster admin, and if I am cluster admin).

So if there are quotas assigned to your namespace, then you can check them via oc get quota : that's your available resources.

But if there are no quotas, then the question is somewhat meaningless. You could make the argument that the "available resources" is the sum of all of the resources on all the schedulable nodes (minus admin overhead). But many clusters have autoscaling and so those resources could expand. But that's kind of a nonsense answer anyway, because you won't be the only workload on the cluster anyway. And, even without autoscaling, the available resources could change at any time. Fundamentally if you don't have any kind of limit or quota, then the maximum resources that your namespace has available is indeterminate.

I need this to set resources limit and requsted for my deployment. But not been able to find answer on openshift console or cli.

This doesn't really make sense. You shouldn't set your requests/limits to the maximum available. If you did that, you might as well not have requests/limits at all. And, as I said before, the resources available might change over time anyway.

You should set your requests/limits on what you need, not what is available. The best way to do this is to just know your application. You should be able to profile your application to know the file/cpu/disk that it needs. (If course, if what you need is less than what you have available, then you will start getting quota errors and scheduling errors etc.)

Not to be trite, but it's the exact same as if you were going to deploy your application to a traditional environment. If I had an application that I wanted to deploy to virtual machines the operations team might ask me how many CPUs I needed, how much memory I needed, and how much disk I needed? Hopefully my answer to that question would not be "How big is your datacenter?" I'd already have a decent idea of how much CPU, memory, and disk I needed.

If you don't have an idea of how much you need just from knowing your application, the Vertical Pod Autoscaler can make recommendations: https://docs.openshift.com/container-platform/4.13/nodes/pods/nodes-pods-vertical-autoscaler.html . (In addition to be an autoscaler it can just observe your application and make recommendations. Look for the recommendationOnly flag.) There are also many third party tools that can help with this kind of analysis.

On the other hand, if your concern is just "I don't know if I will bump into quota and or scheduling limits when I add my requests/limits", then use oc get quota to make sure you are in line with your quota and let the cluster admin worry about the scheduling limits.