Metrics & Dashboards

This section covers how to enable metrics scraping for KubeLB components and set up Grafana dashboards.

Enabling Metrics Scraping

Both kubelb-manager and kubelb-ccm Helm charts support two methods for metrics scraping:

If you have the Prometheus Operator installed, enable the ServiceMonitor:

# values.yaml
serviceMonitor:
  enabled: true

This creates a ServiceMonitor resource that configures Prometheus to scrape the KubeLB metrics endpoint via kube-rbac-proxy over HTTPS on port 8443.

Ensure your Prometheus instance is configured to discover ServiceMonitors across all namespaces. For kube-prometheus-stack, set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false.

Option 2: Pod Annotations (enabled by default)

When ServiceMonitor is disabled (default), standard Prometheus pod annotations are added automatically:

prometheus.io/scrape: "true"
prometheus.io/port: "<metrics-port>"
prometheus.io/path: "/metrics"

Metrics Port Configuration

The internal metrics port can be configured per chart:

ChartValueDefault
kubelb-managermetrics.port9443
kubelb-ccmmetrics.port9445

The external scrape port is always 8443 (kube-rbac-proxy).

Grafana Dashboards

KubeLB provides pre-built Grafana dashboards that can be automatically provisioned via the Grafana sidecar or manually imported.

Automatic Provisioning

Enable dashboard ConfigMaps in the Helm chart:

# values.yaml
grafana:
  dashboards:
    enabled: true

This creates ConfigMaps with the grafana_dashboard: "1" label, which the Grafana sidecar picks up automatically.

If your Grafana instance runs in a different namespace than KubeLB, ensure the sidecar is configured to search all namespaces: grafana.sidecar.dashboards.searchNamespace=ALL.

Manual Import

Dashboard JSON files are located in the dashboards/ directory within each Helm chart:

Import these via the Grafana UI (Dashboards > Import) or API. All dashboards use a datasource template variable — select your Prometheus data source after import.

Example: kube-prometheus-stack

A common setup using kube-prometheus-stack:

helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack \
  --namespace monitoring --create-namespace \
  --set grafana.sidecar.dashboards.enabled=true \
  --set grafana.sidecar.dashboards.searchNamespace=ALL \
  --set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false

Then enable monitoring in KubeLB:

helm upgrade kubelb kubelb-manager \
  --namespace kubelb \
  --set serviceMonitor.enabled=true \
  --set grafana.dashboards.enabled=true

Available Dashboards

The following dashboard subpages provide detailed descriptions:

For the full list of exposed Prometheus metrics, see the Metric References.