How to do it...

In this section, we will work on installing a monitoring system and introducing its dashboard. This monitoring system is based on Heapster (https://github.com/kubernetes/heapster), a resource usage collecting and analyzing tool. Heapster communicates with kubelet to get the resource usage of both machine and container. Along with Heapster, we have influxDB (https://influxdata.com) for storage and Grafana (http://grafana.org) as the frontend dashboard, which visualizes the status of resources in several user-friendly plots:

The interaction of monitoring components

Heapster gathers information from kubelet on each node and provides data for other platforms. In our case, an influxDB is a sink for saving historical data. It is available for users to do further data analysis, such as the prediction of peak workload, and then make corresponding resource adjustments. We have Grafana working as an affable web console; users can manage monitoring status through the browser. Moreover, kubectl has the subcommand top, which provides the ability to grep cluster-wide information through Heapster:

// try kubectl top before installing Heapster
$ kubectl top node
Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)

This command turns out an error message.

Installing a monitoring system could be much easier than anticipated. By applying configuration files from the open-source communities and companies, we can set up component monitoring on Kubernetes simply with the aid of a few commands:

// installing influxDB
$ kubectl create -f https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/influxdb.yaml
deployment "monitoring-influxdb" created
service "monitoring-influxdb" created
// installing Heapster
$ kubectl create -f https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/heapster.yaml
serviceaccount "heapster" created
deployment "heapster" created
//installing Grafana
$kubectl create -f https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/grafana.yaml
deployment "monitoring-grafana" created
service "monitoring-grafana" created

You could find that applying an online source is also feasible for creating Kubernetes applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.121.45