Kubernetes AutoScaler Not Scaling, HPA shows target <unknown> Kubernetes AutoScaler Not Scaling, HPA shows target <unknown> kubernetes kubernetes

Kubernetes AutoScaler Not Scaling, HPA shows target <unknown>


As Heapster is deprecated in later version(v 1.13) of kubernetes, You can expose your metrics using metrics-server also, Please check following answer for step by step instruction to setup HPA:

How to Enable KubeAPI server for HPA Autoscaling Metrics


To answer the question directly, if you have set up an HPA resource and using the metrics server, and ran into this error.

This error means that in your pods, which may have more than one container, either one or both of the containers have not defined resource requests:

Resources:     requests:       cpu: <this is missing! Add it>

Check that all containers have resource requests defined.

To add edit and add resources directly, usekubectl edit <resource>

Kubernetes may not allow you to update if your using helm even with the force flag.

A note, this may cause downtime if you have not set PodDisruptionBudgets so set those before you ran your edit


There are 2 things required to ensure your HPA is functional

  1. metrics server is running
  2. The Scalable resource (Pod/Statefulset) has CPU/Memory resource requests and limits defined. (Talking only in the scope of cpu/mem, while other custom metrics can be enabled to be used by HPA)

Check if metrics server is running -

kubectl get po -n kube-system | grep metric

If you get none listed, you don't have your metric server already running.Refer Readme and install the metrics server. Adding the CPU limits wont help unless your metrics service is running.

Now make sure you have resource requests and limits defined in your pod or your scalable target.

 resources:  requests:    memory: "64Mi"    cpu: "250m"  limits:    memory: "128Mi"    cpu: "250m"

Also, metrics server would be useful, only while you scale based on cpu/memory.