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?
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
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.