Hi, Do you have any suggestions on how to prevent duplicate scraping when using the endpointslice role in this scenario? Could this be resolved with a relabeling rule?
For your reference, I’ve opened an issue on the Prometheus GitHub repository: https://github.com/prometheus/prometheus/issues/17193 Regards, Vu On Friday, September 12, 2025 at 11:15:09 AM UTC+2 Vu Nguyen wrote: > Additionally, I’ve noticed that when the metric port is *not declared* in > the Service manifest where the Prometheus annotations are placed, this > duplication of scraping (both IPv4 and IPv6 targets) from the Endpointslice > role does *not* occur. > > Does this mean that explicitly specifying the metric port in the Service > manifests influences how Endpointslice targets are discovered and scraped? > > Any further clarification on how the metric port declaration interacts > with dual-stack service discovery in Prometheus would be highly appreciated. > On Thursday, September 11, 2025 at 10:25:26 AM UTC+2 Vu Nguyen wrote: > >> I’m testing Prometheus service discovery on a dual-stack Kubernetes >> cluster where the service has ipFamilyPolicy set to PreferDualStack. When >> using the deprecated endpoints scraping role, Prometheus discovers targets >> only with the IPv4 address. >> >> However, when switching to the endpointslice scraping role with the same >> relabeling rules, Prometheus discovers targets with both IPv4 and IPv6 >> addresses for the same service. >> >> ``` >> up{instance="ipv4:9089", job="endpointslice-role", namespace="test-ns", >> pod_name="testapp-5f58b46757-nq7hx", >> service_name="testapp-prefer-dualstack"} 1 >> up{instance="ipv6:9089", job="endpointslice-role", namespace="test-ns", >> pod_name="testapp-5f58b46757-nq7hx", >> service_name="testapp-prefer-dualstack"} 1 >> up{instance="ipv4:9089", job="endpoints-role", namespace="test-ns", >> pod_name="testapp-5f58b46757-nq7hx", >> service_name="testapp-prefer-dualstack"} 1 >> ``` >> >> Is this behavior expected? Should Prometheus handle dual-stack targets >> differently when scraping endpointslice vs endpoints? Are there any best >> practices or configuration nuances to be aware of when migrating from >> endpoints to endpointslice in a dual-stack environment? >> >> Thanks in advance for any insights! >> >> Best Regards, Vu >> > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/prometheus-users/27c56733-2be7-45d2-8e10-f76f8422abffn%40googlegroups.com.

