HorizontalPodAutoscaler does not return TARGETS metrics and returns '<unknown>' on kubectl.
Tomoyuki KOYAMA
Posted on October 1, 2022
I had faced the error: HorizontalPodAutoscaler does not return TARGETS metrics and returns '<unknown>'
on kubectl.
Environment
Kubrenetes engine: RKE2 (v1.22.6+rke2r1) x 3 nodes
Solution
First, I tried to run the following command.
kubectl get --raw /apis/metrics.k8s.io/v1beta1"
The command returns an error.
Second, I installed metrics-server to the cluster.
https://github.com/kubernetes-sigs/metrics-server
I retry to run kubectl get --raw /apis/metrics.k8s.io/v1beta1
. The command runs successfully.
Third, I fixed kubernetes manifests as summarised below.
- Set 'requests' parameter per container in deployment
- Fix resource specs for HPA
https://github.com/cdsl-research/text-checker/commit/e13c178eaa4e1ab140462bf658a4e477f87babb1
https://github.com/cdsl-research/text-checker/commit/1bcc0dc21fc5f3fd8a7b42064e582e23cff303ab
Finally, the command 'kubectl get hpa' returns values 'TARGETS' successfully.
Posted on October 1, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.