How to check maximum memory I can request for a pod in a kubernetes cluster? How to check maximum memory I can request for a pod in a kubernetes cluster? kubernetes kubernetes

How to check maximum memory I can request for a pod in a kubernetes cluster?


There may be namespace specific limits, which could be lower than whats available at the node level. In this case, you will have to consider the namespace limits.

However, if thats not the case, as a starting value, you may the below command and look at the "Requests" column and choose the request value in your pod that is lower than the available amount shown for your most utilized node.

kubectl get node --no-headers | while read node status; do echo '>>>>  ['$node']'; kubectl describe node $node | grep Resource -A 3 ;done>>>>  [node-be-worker-1]  Resource           Requests    Limits  --------           --------    ------  cpu                300m (7%)   100m (2%)  memory             220Mi (2%)  220Mi (2%)>>>>  [node-be-worker-2]  Resource           Requests    Limits  --------           --------    ------  cpu                200m (5%)   100m (2%)  memory             150Mi (1%)  50Mi (0%)>>>>  [node-be-worker-3]  Resource           Requests    Limits  --------           --------    ------  cpu                400m (10%)  2100m (52%)  memory             420Mi (5%)  420Mi (5%)>>>>  [node-master-0]  Resource           Requests    Limits  --------           --------    ------  cpu                650m (32%)  100m (5%)  memory             50Mi (1%)   50Mi (1%)

Explanation: The command lists all the nodes and loops over to describe the nodes and then filters the lines for "Resource" and prints the string and the next 3 lines.

You should be able to tweak the above command to work for namespace too.