The OpenTelemetry Collector, when configured with a Prometheus receiver, provides an integration with kubelet to scrape Prometheus metrics. The Collector uses the Prometheus Receiver to fetch metrics from the configured path. From there, the metrics are processed and exported to Cloud Observability.

To quickly ingest Kubernetes metrics into Cloud Observability using the OpenTelemetry Operator for Kubernetes, see instructions in the Kubernetes Quick Start.

To complete the integration, you will:

  • Configure kubelet to use the Prometheus exporter.
  • Configure the Collector to use the kubelet endpoint as a scrape target for the Prometheus receiver.
  • Enable the integration by adding it to a pipeline.

Prerequisites

You’ve configured the Collector to export metric data to Cloud Observability.

Configure kubelet reporting

You may need to expose kubelet Prometheus metrics. How you do that depends on your deployment model and whether or not the default parameters are appropriate in your case. In kubelet, Prometheus metrics are on port 10255 by default.

For more details on ingesting kubelet metrics see the official documentation on Kubernetes system component metrics.

Configure the Collector receiver

In the Collector configuration file, configure the Prometheus receiver to use the kubelet Prometheus endpoint as a scrape target.

1
2
3
4
5
6
7
receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: 'otel-kubelet'
          static_configs:
            - targets: ['kubelet.kube-system.svc.cluster.local:10255', 'kubelet.kube-system.svc.cluster.local:10255/metrics/cadvisor']

The OpenTelemetry repo’s README provides additional details about Prometheus receiver configuration.

More details about the Prometheus scrape configuration can be found here.

Enable the Collector receiver

Once the kubelet receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.

Validate metrics are reporting to Cloud Observability

You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Settings.

  1. In Cloud Observability, click Settings > Metric details.

  2. Search for kubelet metric names. Arrow points to the metrics search box.

    Kubelet exposes metrics at paths /metrics, /metrics/cadvisor, /metrics/resource, and /metrics/probes. The endpoints have independent lifecycles and may also be configured to include feature gated or hidden metrics. For more details see the official Kubernetes system component documentation.

  3. If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.

Create a dashboard for the metrics

Use the Cloud Observability Terraform Provider to create a dashboard for the metrics.

Additional resources

Learn more about how to Ingest Prometheus metrics using an OpenTelemetry Collector on Kubernetes.

There is a pre-made Cloud Observability dashboard to help you quickly visualize kubelet monitoring.

See also

Create and manage dashboards

Kubernetes

Updated Dec 1, 2022