There are a lot of questions about this topic and I tried a lot of stuff but it's still not working.
I'm new to Kubernetes. I have a Kubernetes Cluster with 2 Nodes (1 PC, 1 VM on a different PC), 1 Master, 1 Node. I started a website (Docker Image) and the Pod is running on the Node (not master). Now I wanted to autoscale the Pod, this is what I did:
--request='cpu=50m'to the pod
- Created hpa:
kubectl autoscale deployment testwebsite --min=1 --max=4 --cpu-percent=25
kubectl get hpa -w
And now there is the problem that the output shows as current value.
I read a lot that I have to assign the request to the pod, as I did. Checked it via:
kubectl get pod testwebsite --out=yaml
I also created the metrics-server version 1.8+. Made sure it's running via:
kubectl get pods --all-namespaces
After that I tried to debug the HPA and looked into it via:
kubectl describe hpa testwebsite
That showed me this:
Name: testwebsite Namespace: default Labels: <none> Annotations: <none> CreationTimestamp: Thu, 04 Apr 2019 14:08:57 +0200 Reference: Deployment/testwebsite Metrics: ( current / target ) resource cpu on pods (as a percentage of request): <unknown> / 25% Min replicas: 1 Max replicas: 4 Deployment pods: 1 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 FailedComputeMetricsReplicas 7m24s (x12 over 10m) horizontal-pod-autoscaler failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API Warning FailedGetResourceMetric 5s (x41 over 10m) horizontal-pod-autoscaler unable to get metrics for resource cpu: no metrics returned from resource metrics API
After 10+ mins it's not showing the current value and it won't scale up even when the cpu has 50-100% usage.
As I said I'm new to Kubernetes and I really hope someone can help me.
Nico aka Myridor
EDIT: Using Ubuntu 18.04 LTS on both Nodes | Kubernetes Version: 1.14.0