Headless service with destination rules

There is a k8s cluster 1.16.7 with istio 1.5.1 and a problem with a headless service.

I’ve already read tons of stuff about headless/statefulset issues, conducted a lot of experimentation to solve this and found a configuration for the pilot (PILOT_ENABLE_EDS_FOR_HEADLESS_SERVICES) which actually seems to solve the problem, but I want to understand the implications and if there is a way to solve this without changing anything globally.

My research led to the conclusion that headless services already work out of the box and appropriate ORIGINAL_DST clusters are created, but endpoints are resolved dynamically (i’m checking istioctl proxy-config endpoints while pinging the service) and the problem is that in this case virtual service configuration with a simple match by the header is completely ignored.

Basically, there are two versions of the service and if header matches it should route to one version and otherwise to another, but with headless service requests are load balanced between all of the pods. Maybe everything goes via “passthrough” cluster and that’s why no special istio configuration applies?

Can anyone confirm my assumptions, why this happens or maybe knows the most proper way to solve this?