1

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?

T. Gibbons
  • 4,919
  • 2
  • 15
  • 32
Abhay Dwivedi
  • 1,500
  • 2
  • 16
  • 22

2 Answers2

0

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 
Suresh Vishnoi
  • 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
0

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.

Suresh Vishnoi
  • 17,341
  • 8
  • 47
  • 55
Mufeed
  • 3,018
  • 4
  • 20
  • 29