Configure kubelet metrics
Each DaemonSet collector scrapes the kubelet on its own node over HTTPS every
30 seconds. The collector connects directly to the node’s host IP on port 10250.
These scrapes do not use a ServiceMonitor or the Target Allocator. The collector
authenticates with its projected service-account token and has read-only
nodes/metrics permission.
The scrape jobs are in the prometheus/kubelet receiver of
daemonset.otelcol.config in nktp/deploy/charts/nktp/values.yaml. By default there are two jobs:
kubeletscrapes/metrics.kubelet-cadvisorscrapes/metrics/cadvisor. Itsmetric_relabel_configsare copied from kube-prometheus-stack. They drop samples that are less useful, always zero, overlapping with kube-state-metrics, from host network interfaces, or from cgroups with no pod.
The chart renders this configuration exactly as written. To change the scrapes,
change the configuration. Helm replaces a list in your values file as a whole,
so copy the full scrape_configs list from nktp/deploy/charts/nktp/values.yaml into your values
file and change your copy.
Change the scrapes
- To stop scraping cAdvisor, remove the
kubelet-cadvisorjob. - To change the cAdvisor filters, edit the job’s
metric_relabel_configs. - To scrape
/metrics/probesor/metrics/resource, copy thekubeletjob. Then give the copy a newjob_name, such askubelet-probes, and set bothmetrics_pathand thereplacementof themetrics_pathrelabel rule to the new path.
Verify kubelet certificates
The certificate authorities that sign kubelet serving certificates, and the subject alternative names in those certificates, vary between Kubernetes distributions. For this reason, certificate verification is disabled by default. Each kubelet certificate must cover the node IP that the collector uses.
To enable verification, first create a ConfigMap in the NVKE telemetry pipeline (NKTP) release namespace that contains the kubelet-serving CA:
Then mount it into the collector. Add this volume to
daemonset.kubernetes.volumes and this mount to
daemonset.kubernetes.volumeMounts. These are lists, so copy the default
entries from nktp/deploy/charts/nktp/values.yaml and add these to them:
Finally, set tls_config in each kubelet scrape job:
Use with kube-prometheus-stack
When kube-prometheus-stack is installed alongside NKTP, disable its kubelet
ServiceMonitor only after NKTP scrapes the kubelet endpoints that you need and
their consumers have moved. This prevents scraping kubelet /metrics twice:
As a best-effort fallback, the DaemonSet Target Allocator excludes
ServiceMonitors with the conventional app labels
kube-prometheus-stack-kubelet and prometheus-operator-kubelet. This prevents
it from assigning a kubelet scrape that another system manages. ServiceMonitor
names and labels are configurable, so this fallback does not find every kubelet
ServiceMonitor.