Skip to content

Grafana dashboard integration

Grafana dashboard integration is the process of connecting Grafana to data sources—such as Prometheus and Kubernetes APIs—and configuring dashboards to visualize metrics collected from a monitored environment^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

Data Source Configuration

To display monitoring data, Grafana requires a configured data source.

Prometheus Integration

The primary data source for cluster metrics is the Prometheus server. The integration requires specifying the Prometheus URL and configuring authentication^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

  • URL: Accessible via the service endpoint (e.g., http://prometheus.od.com)^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
  • Authentication: Supports TLS Client Auth with CA Certificates. Configuration typically involves adding CA certificates (ca.pem) and client certificates (client.pem, client-key.pem) to secure the connection^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

Kubernetes API Integration

To visualize Kubernetes-specific resources (Pods, Deployments, Nodes), Grafana can integrate directly with the Kubernetes API.

  • Access Mode: Set to "Server" (server-side access)^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
  • API URL: Configured for the cluster endpoint (e.g., https://10.4.7.10:7443)^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
  • Authentication: Like Prometheus, this integration requires TLS configuration using CA and client certificates^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

Dashboard Management

Grafana dashboards can be managed through manual JSON import or by utilizing dedicated plugins.

Plugins

Enhanced functionality for Kubernetes monitoring is provided by installing specific plugins^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]:

  • Kubernetes App: A dedicated application for Kubernetes monitoring^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
  • Visualization Panels: Includes plugins such as grafana-clock-panel, grafana-piechart-panel, briangann-gauge-panel, and natel-discrete-panel to enrich dashboard visuals^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

Importing Dashboards

Dashboards can be loaded into Grafana using the Import functionality^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

  • Manual JSON: Users can import dashboard definitions via JSON files directly from their local environment or external repositories^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
  • Official Library: Grafana provides a library of pre-built dashboards accessible via Grafana.com. Users can import dashboards using their unique numerical ID found on the website^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

Specific Dashboard Types

Commonly imported dashboards in this setup include views for: * Cluster health * Node performance * Deployment status * Container metrics * Network monitoring (e.g., Traefik) * JMX metrics for microservices^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]

Application Monitoring (JMX)

Integration extends to application-level monitoring using JMX Exporters.

  • Annotation-Based Discovery: Services can be configured with annotations (e.g., prometheus_io_scrape, prometheus_io_port, prometheus_io_path) to allow Prometheus to scrape JMX metrics^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].
  • Visualization: Once scraped by Prometheus, these Java application metrics can be visualized in dedicated "JMX" dashboards within Grafana^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md].

Sources