mirror of
https://github.com/prometheus-operator/kube-prometheus.git
synced 2025-12-20 00:21:01 +01:00
1.5 KiB
1.5 KiB
Migration from Endpoints to EndpointSlice
kube-prometheus 0.17+ automatically configures Prometheus to use EndpointSlice instead of Endpoints for Kubernetes service discovery (Endpoints have been deprecated in Kubernetes 1.33).
While the migration should be seamless for "regular" pods, it requires a few manual steps for components running as host services (e.g. node_exporter and kubelet):
- The node_exporter and kubelet ServiceMonitors rely on the Prometheus operator's kubelet controller which manages the
kube-system/kubeletService. - With
kube-prometheus0.17, the Prometheus operator starts with both--kubelet-endpoints=trueand--kubelet-endpointslice=trueto ensure that a) the operator synchronizes the EndpointSlice object(s) backing thekube-system/kubeletService and b) Kubernetes stops mirroring thekube-system/kubeletEndpoints object to EndpointSlice object(s) (otherwise the operator and kube-controller-manager would fight for the same resources). - After verifying that all targets are correctly discovered, it is ok to modify the operator's deployment and use
--kubelet-endpoints=falseinstead. This will become the default in a future version ofkube-prometheus. - The
kube-system/kubeletEndpoints object should be removed manually.
To verify the status of the Endpoints and EndpointSlice objects, run:
kubectl get -n kube-system endpoints kubelet
kubectl get -n kube-system endpointslice -l endpointslice.kubernetes.io/managed-by=prometheus-operator