Running kubernetes autoscalar

不羁的心 提交于 2019-12-01 21:14:17

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 hepaster 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 hepaster 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 avaibale 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!