Grafana K8S – DevOpsProdigy KubeGraf

DevOpsProdigy KubeGraf is an excellent Grafana Kubernetes plug-in, which is an upgraded version of the official Grafana Kubernetes plug-in. This plug-in can be used to visualize and analyze the performance of Kubernetes clusters. Through a variety of graphical intuitive display of the Kubernetes cluster main service indicators and characteristics, can also be used to check the application life cycle and error log.

Environmental requirements

To install the DevOpsProdigy KubeGraf plug-in, the following requirements must be met:

  • Grafana > version 5.0.0
  • Prometheus + Node-exporter + kube-state-metrics is required on the Kubernetes cluster
  • Relies on the Grafana-Piechart-Panel plug-in

features

The plug-in contains three main information pages that contain detailed information about the Kubernetes cluster.

Application overview

This plugin displays some basic monitoring information for applications on the Kubernetes cluster:

  • Application logic diagram
  • Distribution of Kubernetes objects
  • Visualize application lifecycle and basic characteristic information
  • Description of the service ports allowed to access in the cluster

State of the cluster

  • Status information about clusters and cluster nodes
  • Details of the monitored application life cycle
  • Visualization of the location of services in a cluster

Summary of the node

  • Cluster Node Information
  • Information about used and allocated resources (memory, CPU utilization) and the number of containers
  • Physical distribution of Pods

Dashboards

In addition to the usual information on the plug-in home page, the plug-in also provides five additional dashboards to track various performance metrics for the cluster.

  • node dashboard

This is a Dashboard with node metrics that show resource usage, such as CPU utilization, memory consumption, percentage of CPU time in idle/IOWAIT mode, and disk and network status.

  • pod dashboard

The resource usage can be displayed based on the selected Pod.

  • deployments dashboard

Displays the resource usage associated with the corresponding resource object in the Deployment dimension.

  • statefulsets dashboard
  • daemonsets dashboard

The three dashboards above show the number of copies of available/unavailable applications and the container status of those applications, as well as tracking container restarts.

The installation

Grafana is also installed on the Kubernetes cluster, so we need to go into the container to install:

$ kubectl get pods -n kube-mon
NAME                         READY   STATUS    RESTARTS   AGE
grafana-5579769f64-7729f     1/1     Running   0          104s
......
$ kubectl exec -it grafana-5579769f64-7729f -n kube-mon /bin/bashInstall devopsprodigy-kubegraf-app installing Devopsprodigy -kubegraf-app @1.3.0 from: https://grafana.com/api/plugins/devopsprodigy-kubegraf-app/versions/1.3.0/download into: /var/lib/grafana/plugins split-installed devopsprodigy-kubegraf-app successfully Restart grafana after installing plugins. <service grafana-server restart> bash-5.0# # If grafana-piechart-panel is not installed, install bash-5.0# grafana-piechart-panel install Grafana-piechart-panel ......Copy the code

After installing the plugin, you need to restart Grafana for it to take effect. Here is Pod, so you can directly delete Pod and rebuild it (of course, the plugin directory needs to be persisted) :

$ kubectl delete pod grafana-5579769f64-7729f -n kube-mon
pod "grafana-5579769f64-7729f" deleted
Copy the code

Once the Pod is removed and rebuilt, the plug-in is installed successfully. Then open Grafana in your browser to find the plug-in and click Enable to enable the plug-in.

Click Set Up your first K8S-cluster to create a new Kubernetes cluster:

  • Kubernetes Service address: kubernetes.default:443
  • Access mode uses:Server(default)
  • Since the plug-in accesses the various resource object information of the Kubernetes cluster, we need to configure the access permissions. Here we can simply use KubectlkubeconfigTo configure.
  • Check under AuthTLS Client AuthWith CA CertTwo options
  • Among themTLS Auth DetailsThe values below correspondkubeconfigCertificate information. Like what we have herekubeconfigThe file format is as follows:
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: <certificate-authority-data>
    server: https://ydzs-master:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: 'kubernetes-admin@kubernetes'
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: <client-certificate-data>
    client-key-data: <client-key-data>
Copy the code

The value of CA Cert corresponds to the base64 decoding value of

in kubeconfig. The value of Client Cert corresponds to the base64 decoding value of

. The Client Key value corresponds to the base64 decoding value of

.


Online services such as www.base64decode.org/ are recommended for Base64 decoding, which is very convenient.

  • Finally, inadditional datasourcesSelect the data source for Prometheus from the drop – down list.
  • Click on theSave & TestNormal can be saved successfully.

After the plug-in configuration is complete, the entry of DevOpsProdigy KubeGraf plug-in will appear in the left sidebar, through which you can view the status of the entire cluster and the relevant Dashboard monitoring chart.

Wechat official account

Scan the qr code below to follow our wechat account and reply ◉ and join our Kubernetes discussion group to learn together.