Grafana
Grafana is an open-source data visualization and graph composer platform for numeric time-series data with Prometheus integration.
Image repository and tag
- Grafana image: grafana/grafana:9.5.5
- Grafana repository: https://github.com/grafana/grafana
- Grafana documentation: https://docs.grafana.org
- k8s-sidecar image: kiwigrid/k8s-sidecar
- k8s-sidecar repository: https://github.com/kiwigrid/k8s-sidecar
- k8s-sidecar documentation: https://github.com/kiwigrid/k8s-sidecar/blob/master/README.md
Requirements
- Kubernetes >= 1.26.0
- Kustomize = v3.5.3
Configuration
Fury distribution Grafana is deployed with the following configuration:
- Replica number: 1
- Anonymous authentication enabled
- Adminrole for unauthenticated users
- Resource limits are 200mfor CPU and200Mifor memory
- Listens on port 3000
- Prometheus configured as the data source
Add new dashboards
Grafana will try to load automatically all the files inside configMaps that have the grafana-sighup-dashboard label from all namespaces.
To add a custom dashboard to Grafana, follow the next steps:
- Create a configMap that includes the dashboard definition jsonfile (you can include more than one json per configMap)
- Add the grafana-sighup-dashboardlabel to the configMap, the value is not important.
- If you want to put the dashboard(s) in a specific Grafana folder, for example myfolder, add the following annotation to the configMap:grafana-folder: myfolder.
Look at the dashboards folder kustomization.yaml for some examples.
Add new datasource
Additionally, you can create a ConfigMap/Secret in your namespace with a datasource definition then labeling it
with the label key grafana-sighup-datasource, the value of the label is up to you. Labeling it, the sidecar k8s-sidecar
will take care of it and inject it into a shared volume and send an API reload signal to grafana itself.
Look at the datasources folder kustomization.yaml for an example.
Deployment
You can deploy Grafana by running the following command:
kustomize build | kubectl apply -f -
Accessing Grafana UI
You can access Grafana Dashboard by port-forwarding on port 3000:
kubectl port-forward svc/grafana 3000:3000 --namespace monitoring
Grafana will be available on http://127.0.0.1:3000 from your browser.
Adding/Removing Dashboards
To learn how to add or remove dashboards to Grafana please see the examples folder.