Search code examples
amazon-web-serviceskubernetesamazon-eks

EKS kubernetes hpa returns CPU unknown


I am using EKS and try this article step by step.

https://repost.aws/en/knowledge-center/eks-metrics-server-pod-autoscaler

However, CPU status is unknown.

$kubectl get hpa
NAME         REFERENCE               TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
php-apache   Deployment/php-apache   <unknown>/50%   1         10        0          3s

I have googled around and found similar problem this , so I try

1, download metrics-server

wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

2, add --kubelet-insecure-tls

  template:
    metadata:
      labels:
        k8s-app: metrics-server
    spec:
      containers:
      - args:
        - --cert-dir=/tmp
        - --secure-port=4443
        - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
        - --kubelet-use-node-status-port
        - --metric-resolution=15s
        - --kubelet-insecure-tls # add here

However still CPU metrics doesn't work.

Does anyone have the same problem for EKS?

Solution

I check memory kubectl top pod php-apache-cd47555dc-wskwk

then it returns correct number and kubectl get hpa also works....

I am not sure why, but it works for now...


Solution

  • Solution

    I check memory kubectl top pod php-apache-cd47555dc-wskwk

    then it returns correct number and kubectl get hpa also works....

    I am not sure why, but it works for now...