Running kubernetes autoscalar Running kubernetes autoscalar kubernetes kubernetes

Running kubernetes autoscalar


Most probably heapster is running in a wrong namespace ("default"). HPA expects heapster to be in "kube-system" namespace. Please, add --namespace=kube-system to kubectl run heapster command.


I installed hepaster under the name space "kube-system" and it worked. After running heapster, make sure it's running before you use HPA for your application.

How to run Heapster with Kubernetes cluster

I put all files here https://gitlab.com/abushoeb/kubernetes/tree/master/heapster. They are collected from the official Kubernetes Repository and made minor changes.

How to run Heapster

Go to the directory heapster where you have grafana.yaml, heapster.yaml and influxdb.yaml and run following command

$ kubectl create -f  .

How to stop Heapster

Go to the same heapster directory and then run following command

$ kubectl delete -f  .

How to check Heapster is running

You can access heapster metric model from the pod where heapster is running to make sure heapster is working. It can be accessed via web browser by accessing http://heapster-pod-ip:heapster-service-port/api/v1/model/metrics/. The same result can be seen by executing following command.

$ curl -L http://heapster-pod-ip:heapster-service-port/api/v1/model/metrics/

If you see the list of metrics then heapster is running correctly. You can also browse grafana dashboard to see it (find the ip of the pod where grafana is running and the access it http://grafana-pod-ip:grafana-service-port).

Full documentation of Heapster Metric Model are available here.

Also just run ($ kubectl cluster-info) and see if it shows results like this:

Kubernetes master is running at https://cluster-ip:6443

Heapster is running at https://cluster-ip:6443/api/v1/proxy/namespaces/kube-system/services/heapster

kubernetes-dashboard is running at https://cluster-ip:6443/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard

monitoring-grafana is running at https://cluster-ip:6443/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana

monitoring-influxdb is running at https://cluster-ip:6443/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb

Check influxdb

You can also check influxdb if it has data in it. Install Influxdb Client on your local machine to get connected to infuxdb database.

$ influx -host <cluster-ip> -port <influxdb-service-port>

Some Sample influxdb queries

  • show databases
  • use db-name
  • show measurements
  • select value from "cpu/node_capacity"

Reference and Help