[Kubernetes (K8S) Grafana] Use DevOpsProdigy KubeGraf plugin for Grafana to visualize and analyze your Kubernetes (K8S) cluster’s performance

DevOpsProdigy KubeGraf

DevOpsProdigy KubeGraf is the Kubernetes plugin for Grafana.

This plugin allows you to visualize and analyze your Kubernetes cluster’s performance. It demonstrates in graphics the main service metrics and characteristics of the Kubernetes cluster. It also makes it easier to examine the application’s life cycle and error logs.

Features

The plugin consists of three main info pages with detailed information about the Kubernetes cluster.

  • Applications overview

  • Cluster status

  • Nodes overview

  • Dashboards

    • Node dashboard

    • Pod resources

    • Deployment dashboard

    • Statefulsets dashboard

    • Daemonsets dashboard

Prerequisites

  • Kubernetes (K8S)

    Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.

    For more information about installing and using Kubernetes (K8s), see the Kubernetes (K8s) Docs.

Installation

Get pod name for grafana-server.

1
2
$ kubectl get pods -A | grep grafana
loki-stack loki-stack-grafana-6df9978f9f-smdxh 1/1 Running 0 24m

Enter into grafana-server pod shell.

1
$ kubectl exec -it -n infra loki-stack-grafana-6df9978f9f-smdxh -- /bin/bash
1
$ grafana-cli plugins install devopsprodigy-kubegraf-app

And restart grafana-server pod.

Kubernetes Manifests

Create namespace kubegraf and apply Kubernetes manifests from kubernetes/ directory to give required permissions to the user grafana-kubegraf:

1
2
3
4
5
6
7
8
9
$ kubectl create ns kubegraf

$ kubectl apply -f https://raw.githubusercontent.com/devopsprodigy/kubegraf/master/kubernetes/serviceaccount.yaml

$ kubectl apply -f https://raw.githubusercontent.com/devopsprodigy/kubegraf/master/kubernetes/clusterrole.yaml

$ kubectl apply -f https://raw.githubusercontent.com/devopsprodigy/kubegraf/master/kubernetes/clusterrolebinding.yaml

$ kubectl apply -f https://raw.githubusercontent.com/devopsprodigy/kubegraf/master/kubernetes/secret.yaml

Token

Get the grafana-kubegraf-secret token:

1
$ kubectl get secret grafana-kubegraf-secret -o jsonpath={.data.token} -n kubegraf | base64 -d

Configuration

Enable devopsprodigy-kubegraf-app Plugin

Go to <Your Grafana URL>/plugins/devopsprodigy-kubegraf-app in Grafana, then click Enable.

Create Cluster

Select create cluster.

Or Go to the Configuration / Data Sources and add data source for DevOpsProdigy KubeGraf.

Config the following properties:

  • HTTP

    • URL: Kubernetes master’s url from kubectl cluster-info or kubeconfig.

    • Server access mode (Default):

      All requests will be made from the browser to Grafana backend/server which in turn will forward the requests to the data source and by that circumvent possible Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the grafana backend/server if you select this access mode.

    • Browser access mode:

      All requests will be made from the browser directly to the data source and may be subject to Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the browser if you select this access mode.

  • Auth

    • With Credentials: Enable

    • Skip TLS Verify: Enable

  • Bearer token access

    • Access via token: Enable

    • Token: The above grafana-kubegraf-secret token.

  • Additional

    • Additional Prometheus datasource: Prometheus

FAQs

grafana-piechart-panel v>=1.3.7 either does not exist or is not supported on your system

1
2
$ grafana-cli plugins install devopsprodigy-kubegraf-app
grafana-piechart-panel v>=1.3.7 either does not exist or is not supported on your system

Grafana 6.x Working fine, but Grafana 8+ will have this error.

403 Page Not Found

Grafana 6.x Working fine, but Grafana 8+ will have this error when visit `/plugins/devopsprodigy-kubegraf-app/page/clusters.

error: unable to recognize “clusterrole.yaml”: no matches for kind “ClusterRole” in version “rbac.authorization.k8s.io/v1beta1

1
2
$ kubectl apply -f https://raw.githubusercontent.com/devopsprodigy/kubegraf/master/kubernetes/clusterrole.yaml
error: unable to recognize "clusterrole.yaml": no matches for kind "ClusterRole" in version "rbac.authorization.k8s.io/v1beta1"

The rbac.authorization.k8s.io/v1beta1 API version of ClusterRole, ClusterRoleBinding, Role, and RoleBinding is no longer served as of v1.22.

  • Migrate manifests and API clients to use the rbac.authorization.k8s.io/v1 API version, available since v1.8.

  • All existing persisted objects are accessible via the new APIs

  • No notable changes

Change rbac.authorization.k8s.io/v1beta1 to rbac.authorization.k8s.io/v1 on Kubernetes 1.22+

1
2
3
4
# clusterrole.yaml

- apiVersion: rbac.authorization.k8s.io/v1beta1
+ apiVersion: rbac.authorization.k8s.io/v1

References

[1] DevOpsProdigy KubeGraf plugin for Grafana | Grafana Labs - https://grafana.com/grafana/plugins/devopsprodigy-kubegraf-app/

[2] devopsprodigy/kubegraf: Grafana-plugin for k8s’ monitoring - https://github.com/devopsprodigy/kubegraf

[3] Grafana: The open observability platform | Grafana Labs - https://grafana.com/

[4] Kubernetes - https://kubernetes.io/

[5] Deprecated API Migration Guide | Kubernetes - https://kubernetes.io/docs/reference/using-api/deprecation-guide/