I have installed kubeadm. Heapster show me metrics, but hpa no
kubectl get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
httpd Deployment/httpd <unknown> / 2% 2 5 2 19m
kubeadm version
kubeadm version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:21:54Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}
docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 22:00:43 2016
OS/Arch: linux/amd64
you have to enable the metrics server which you can do it using the helm chart
helm chart is easy way to add the metrics server
helm install stable/metrics-server
wait for 3-4 minutes after pods started running and you open kubectl get hpa
you can check there target is showing values.
In kubernetes it can say unknown for hpa. In this situation you should check several places.
with heapster you should check kube-controller-manager. Add these parameters.
based on https://github.com/kubernetes/kubernetes/issues/57673
I found this link very informative https://blog.inkubate.io/deploy-kubernetes-1-9-from-scratch-on-vmware-vsphere/
You may have had to enable a metrics-server. Heapster is now deprecated. Also make sure you have Kubernetes version greater than 1.7. You can check this buy typing kubectl get nodes
.
You can enable the metrics server by looking at the minikube addons.
minikube addons list
gives you the list of addons.
minikube addons enable metrics-server
enables metrics-server.
Wait a few minutes, then if you type kubectl get hpa
the percentage for the TARGETS <unknown>
should appear.
I found the solution:
kubectl describe hpa
failed to get cpu utilization: missing request for cpu on container httpd in pod default/httpd-796666570-2h1c6
Change the yaml of deployment and add:
resources:
requests:
cpu:400m
Then kubectl describe hpa
failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from heapster
Wait a few minutes and all works fine.