'kubectl get hpa' does not show external metrics displays "<unknown type>"

12/26/2018

We have our cluster setup in GKE and scaling our pods with 'external metrics' from stack-drive. The scaling works fine, but when I try to see the status with command

$ kubectl get hpa

It shows 'unknown type' in TARGET instead of the actual value as below.

NAME                      REFERENCE                            TARGETS          MINPODS   MAXPODS   REPLICAS   AGE
accounts-service          Deployment/accounts-service          <unknown type>        1         200       1          15d

My current kubectl version shows as

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.6", GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.5-gke.4", GitCommit:"0c81dc1e8c26fa2c47e50072dc7f98923cb2109c", GitTreeState:"clean", BuildDate:"2018-12-07T00:22:06Z", GoVersion:"go1.10.3b4", Compiler:"gc", Platform:"linux/amd64"}

Has anyone faced similar problem?

-- arunk2
google-kubernetes-engine
kubectl
kubernetes

2 Answers

12/26/2018

Actually upgrading the kubectl client in my machine solved this issue.

I followed the steps per the accepted answer and it showed the 'External Metric' as expected. How to upgrade kubectl client version

Posting it just in case someone else face the same issue.

-- arunk2
Source: StackOverflow

12/26/2018

In my case I had to add the following flag to kube-controller of all masters.

horizontalPodAutoscalerUseRestClients: true

-- mr.franco
Source: StackOverflow