I am very interesed in testing kubernete auto-scale solution in Ubuntu installation. I already used it in minikube, with heapster, but since it is deprecated already, I tried to use metric server. Now in my Ubuntu, I installed metrics-server like below:
kube-system kube-apiserver-kmaster 1/1 Running 1 11d
kube-system kube-controller-manager-kmaster 1/1 Running 1 11d
kube-system kube-proxy-47k6b 1/1 Running 0 11d
kube-system kube-proxy-q8zdw 1/1 Running 1 11d
kube-system kube-scheduler-kmaster 1/1 Running 1 11d
kube-system kubernetes-dashboard-5f7b999d65-6wl6k 1/1 Running 1 11d
kube-system metrics-server-548456b4cd-wxc9b 1/1 Running 0 3d18h
metallb-system controller-cd8657667-ckpn6 1/1 Running 0 8d
metallb-system speaker-m9599
But when I check HPA I always saw below:
Kubectl get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
api-server Deployment/api-server <unknown>/50% 1 10 3 3d19h
ngsc Deployment/ngsc <unknown>/50% 1 10 3 3d19h
Seemed metric service is not used for calculating the usage.
I went to Kubernetes doc site, and really can not figure out how to config the utilization for the metric-server so that Kubernetes do the auto-scale.
I describe the auto-scale:
api-server
Namespace: default
Labels: <none>
Annotations: <none>
CreationTimestamp: Fri, 03 May 2019 05:49:07 +0000
Reference: Deployment/api-server
Metrics: ( current / target )
resource cpu on pods (as a percentage of request): <unknown> / 50%
Min replicas: 1
Max replicas: 10
Deployment pods: 3 current / 0 desired
Conditions:
Type Status Reason Message
---- ------ ------ -------
AbleToScale True SucceededGetScale the HPA controller was able to get the target's current scale
ScalingActive False FailedGetResourceMetric the HPA was unable to compute the replica count: unable to get metrics for resource cpu: no metrics returned from resource metrics API
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedGetResourceMetric 4m48s (x22069 over 3d20h) horizontal-pod-autoscaler unable to get metrics for resource cpu: no metrics returned from resource metrics API
Describe for deployment:
Pod Template:
Labels: app=api-server
Containers:
api-server:
Image: xxxxxx
Port: <none>
Host Port: <none>
Limits:
cpu: 500m
Requests:
cpu: 200m
Environment: <none>
Mounts: <none>
Volumes: <none>
This means the deployment has the resource cofiguration. But still hpa shows unknown
Add memory, now describe is:
Limits:
cpu: 500m
memory: 1Gi
Requests:
cpu: 500m
memory: 512Mi
But kubectl get hpa is still unknown.
Checking logs for the metrics-server:
1 manager.go:111] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:kmaster: unable to fetch metrics from Kubelet kmaster (kmaster): Get https://kmaster:10250/stats/summary/: dial tcp: lookup kmaster on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:knode: unable to fetch metrics from Kubelet knode (knode): Get https://knode:10250/stats/summary/: dial tcp: lookup knode on 10.96.0.10:53: no such host]
E0507 05:20:23.797590 1 reststorage.go:148] unable to fetch pod metrics for pod default/api-server-777b78ccf5-mlt94: no metrics known for pod
E0507 05:20:23.797614 1 reststorage.go:148] unable to fetch pod metrics for pod default/api-server-777b78ccf5-r66bw: no metrics known for pod
And when
curl -k https://knode:10250/stats/summary/`
I got this error:
Unauthorized