【EKS】HPAを設定したのに、Podがスケールアウトしない場合

本記事では、HPA (Horizontal Pod Autoscaler)を設定したのに、Podがスケールアウトしない場合の対処法について解説する。

dashboard

説明


下記コマンドを実行時、下記のようなwarningが表示される場合、HPAの設定に不備がある。

kubectl get hpa -A
kubectl describe hpa <HPA Resource Name> -n <Namespace Name>

Warning FailedGetResourceMetric 45s (x1720 over 7h10m) horizontal-pod-autoscaler failed to get cpu usage: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)

Metrics:( current / target ) resource cpu on pods: / 1300m

この場合、下記を実行する必要がある。

解決策


Metric Serverのインストール

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