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-server container reverts back.

  • How to modify the metrics-server container 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.

Error

Direct update to the requests and limits for the metrics-server container running inside the metric-server pod won't work.

Info

Updating the requests and limits for the metrics-server-nanny container running inside the metric-server pod will work without updating the Config Map.

  1. Take a backup of the existing metrics-server-nanny-config config map using the command given below:

$ kubectl get cm -n kube-system metrics-server-nanny-config -o yaml > metrics-server-nanny-config.yaml.bk
  1. Edit the Config Map.

$ kubectl edit cm -n kube-system metrics-server-nanny-config
  1. Update the below fields with the desired value and save the config map.

baseCPU: 80m # This is minimum CPU required for the container similar to pod request cpuPerNode: 1m baseMemory: 80Mi # This is minimum Memory required for the container similar to pod request memoryPerNode: 2Mi
Info

CPU and Memory calculations are done by the metrics-server-nanny container for the metrics-server container is based on the number of nodes running on the cluster.

CPU = baseCPU + extraCpu * max(nodes, minClusterSize)

Memory = baseMem + extraMemory * max(nodes, minClusterSize)

Here, CPU and Memory are the Limits that will be applied to the metric-server container. baseCPU, baseMem values can be retrieved from the existing metrics-server-nanny-config Config Map. However, values such as extraCpu(default is 1), extraMemory (default is 2) and minClusterSize (default is 10) can be retrieved from the metric-server cluster add-on, which are applicable only for Self-Hosted Private Cloud Director Kubernetes.

  1. Save the Config Map.

  2. Delete the metrics-server pod in the kube-system namespace and it should redeploy pod with new updated value as per updated config map.

Validation

  1. Validate the latest updated value in Config Map and Pod status.

$ kubectl get cm -n kube-system metrics-server-nanny-config -o yaml $ kubectl get pods -n kube-system | grep -i "metrics-server"
  1. Latest Limits set to the metrics-server container running inside the metric-server pod.

  2. If these steps prove insufficient, reach out to the Platform9 Support Team for additional assistance.


Add-On