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/5c2db4c7-672e-4ef8-ba35-3fb63256fd5fn%40googlegroups.com.

Reply via email to