I am trying to get metric data like network in and out bytes, disk read and write speed, etc. On kubernetes dashboard, I am only getting memory and CPU data. I have even installed heapster, influx db and grafana in the kube-system namespace. When I run the command kubectl cluster-info it says, "This site can’t be reached." So, it seems the dashboard is running but not other API's. Is there any other way to fetch this metric data?

- 4,919
- 2
- 15
- 32

- 1,500
- 2
- 16
- 22
-
I would suggest you check out cAdvisor. It provides resource usage and performance characteristics of running containers in K8s cluster. – Suresh Vishnoi Nov 08 '17 at 12:05
-
Grammatical corrections – T. Gibbons Nov 08 '17 at 19:20
2 Answers
As you have installed heapster, influxdb and grafana. Therefore, you can aceess CPU, MEMORY and Storage Resouces by using the following command.
kubectl top pods --all-namespaces
.
this command allows you to access resources consumption for pods.
furthermore, if you want to access resources consumptions for nodes.Then, you can shoot this command
kubectl top nodes

- 17,341
- 8
- 47
- 55
-
The above commands seemed to work but only giving me memory and cpu data not network or disk information.Is there anything which i could do to get these metrics value?. – Abhay Dwivedi Nov 10 '17 at 06:15
-
The command "kubectl top pods -all-namespaces" should have another dash before all to be "kubectl top pods --all-namespaces" – samkreter Dec 11 '17 at 21:59
Yes, you can get those data from heapster api.
Just add a new entry to your heapster.yaml file.
Under spec(service) add
type: NodePort
(actullly you are exposing the heapster API by doing so).
Now your heapster.yaml file portion should look something like this
spec:
type: NodePort
ports:
- port: 80
targetPort: 8082
selector:
k8s-app: heapster
Now deploy your heapster.yaml again.
Now get services list from your kubernetes cluster using the followng command.
kubectl get services -n kube-system
There you can see the port of heapster something like this:
80:31637/TCP
Now try to access the heapster API with the cluster IP and port.
Something like this:
http://192.168.99.100:31637/api/v1/model/metrics
You should be able to see the metrics now.
Refer https://github.com/kubernetes/heapster/blob/master/docs/model.md for further information.

- 17,341
- 8
- 47
- 55

- 3,018
- 4
- 20
- 29