How to Modify the Metrics-Server Container Limits?
Problem
A metrics-server container running inside the metrics-server pod is frequently restarting because it's being OOMKilled due to insufficient resources.
Requests and Limits change applied to the
metrics-servercontainer reverts back.How to modify the
metrics-servercontainer limits?
Environment
Private Cloud Director Kubernetes – v2025.4 and Higher
Self-Hosted Private Cloud Director Kubernetes - v2025.4 and Higher
Component - Metric Server Add-on.
Procedure
The metrics-server container running inside the metric-server pod retrieves its value from the metrics-server-nanny-config config map. This config map needs to be updated to push the latest configuration.
Direct update to the requests and limits for the
metrics-servercontainer running inside the metric-server pod won't work.
Updating the requests and limits for the
metrics-server-nannycontainer running inside the metric-server pod will work without updating the Config Map.
Take a backup of the existing
metrics-server-nanny-configconfig map using the command given below:
$ kubectl get cm -n kube-system metrics-server-nanny-config -o yaml > metrics-server-nanny-config.yaml.bkEdit the Config Map.
Update the below fields with the desired value and save the config map.
CPU and Memory calculations are done by the
metrics-server-nannycontainer for themetrics-servercontainer is based on the number of nodes running on the cluster.> > CPU = baseCPU + extraCpu * max(nodes, minClusterSize)> > Memory = baseMem + extraMemory * max(nodes, minClusterSize)> > Here,CPUandMemoryare theLimitsthat will be applied to themetric-servercontainer.baseCPU,baseMemvalues can be retrieved from the existingmetrics-server-nanny-configConfig Map. However, values such asextraCpu(default is 1),extraMemory(default is 2) andminClusterSize(default is 10) can be retrieved from themetric-servercluster add-on, which are applicable only for Self-Hosted Private Cloud Director Kubernetes.
Save the Config Map.
Delete the
metrics-serverpod in thekube-systemnamespace and it should redeploy pod with new updated value as per updated config map.
Validation
Validate the latest updated value in Config Map and Pod status.
Latest Limits set to the
metrics-servercontainer running inside the metric-server pod.If these steps prove insufficient, reach out to the Platform9 Support Team for additional assistance.
Last updated
