I have a replication controller running with the following spec:
apiVersion: v1 kind: ReplicationController metadata: name: owncloud-controller spec: replicas: 1 selector: app: owncloud template: metadata: labels: app: owncloud spec: containers: - name: owncloud image: adimania/owncloud9-centos7 ports: - containerPort: 80 volumeMounts: - name: userdata mountPath: /var/www/html/owncloud/data resources: requests: cpu: 400m volumes: - name: userdata hostPath: path: /opt/data
Now I run a hpa using autoscale command.
$ kubectl autoscale rc owncloud-controller --max=5 --cpu-percent=10
I have also started heapster using kubernetes run command.
$ kubectl run heapster --image=gcr.io/google_containers/heapster:v1.0.2 --command -- /heapster --source=kubernetes:http://192.168.0.103:8080?inClusterConfig=false --sink=log
After all this, the autoscaling never kicks in. From logs, it seems that the actual CPU utilization is not getting reported.
$ kubectl describe hpa owncloud-controller Name: owncloud-controller Namespace: default Labels: <none> Annotations: <none> CreationTimestamp: Thu, 26 May 2016 14:24:51 +0530 Reference: ReplicationController/owncloud-controller/scale Target CPU utilization: 10% Current CPU utilization: <unset> Min replicas: 1 Max replicas: 5 ReplicationController pods: 1 current / 1 desired Events: FirstSeen LastSeen Count From SubobjectPath Type Reason Message --------- -------- ----- ---- ------------- -------- ------ ------- 44m 8s 92 {horizontal-pod-autoscaler } Warning FailedGetMetrics failed to get CPU consumption and request: metrics obtained for 0/1 of pods 44m 8s 92 {horizontal-pod-autoscaler } Warning FailedComputeReplicas failed to get CPU utilization: failed to get CPU consumption and request: metrics obtained for 0/1 of pods
What am I missing here?