istio: Issue with DNS autoallocate V2 - traffic going out the wrong VIP

Is this the right place to submit this?

  • This is not a security vulnerability or a crashing bug
  • This is not a question about how to use Istio

Bug Description

We recently upgraded to Istio 1.24 (canary install), using the new functionality PILOT_ENABLE_IP_AUTOALLOCATE. Our ServiceEntries now have VIP’s propagated right under their status field. Most of our apps are going smoothly and fine…until today.

We had a developer contact us that his RabbitMQ cluster was borked. Turns out, the requests for x.zone:5671 are going out the VIP for the ServiceEntry for x.zone:5672!

ServiceEntries in-place:

apiVersion: networking.istio.io/v1
kind: ServiceEntry
metadata:
  name: rabbitmq-test-novarabbit
  namespace: rabbitmq-test
spec:
  exportTo:
    - .
  hosts:
    - rabbitmq-test-amqp.nova-np.x.zone
  location: MESH_EXTERNAL
  ports:
    - name: novarabbit
      number: 5672
      protocol: TCP
  resolution: DNS
status:
  addresses:
    - host: rabbitmq-test-amqp.nova-np.x.zone
      value: 240.240.0.159
    - host: rabbitmq-test-amqp.nova-np.x.zone
      value: 2001:2::9f
---
apiVersion: networking.istio.io/v1
kind: ServiceEntry
metadata:
  name: rabbitmq-test-novarabbit-1
  namespace: rabbitmq-test
spec:
  exportTo:
    - .
  hosts:
    - rabbitmq-test-amqp.nova-np.x.zone
  location: MESH_EXTERNAL
  ports:
    - name: novarabbitamqps
      number: 5671
      protocol: TCP
  resolution: DNS
status:
  addresses:
    - host: rabbitmq-test-amqp.nova-np.x.zone
      value: 240.240.0.160
    - host: rabbitmq-test-amqp.nova-np.x.zone
      value: 2001:2::a0

In the istio-logs:

rabbitmq-test-1 istio-proxy [2025-02-25T19:37:42.136Z] "- - -" 0 UH "-" 0 0 0 - "-" "-" "-" "-" "-" BlackHoleCluster; - 240.240.0.159:5671 100.64.16.49:36288 - - - -
rabbitmq-test-1 istio-proxy [2025-02-25T19:37:47.143Z] "- - -" 0 UH "-" 0 0 0 - "-" "-" "-" "-" "-" BlackHoleCluster; - 240.240.0.159:5671 100.64.16.49:47622 - - - -
rabbitmq-test-1 istio-proxy [2025-02-25T19:37:52.150Z] "- - -" 0 UH "-" 0 0 0 - "-" "-" "-" "-" "-" BlackHoleCluster; - 240.240.0.159:5671 100.64.16.49:47636 - - - -
rabbitmq-test-1 istio-proxy [2025-02-25T19:37:57.157Z] "- - -" 0 UH "-" 0 0 0 - "-" "-" "-" "-" "-" BlackHoleCluster; - 240.240.0.159:5671 100.64.16.49:38500 - - - -
rabbitmq-test-1 istio-proxy [2025-02-25T19:38:02.163Z] "- - -" 0 UH "-" 0 0 0 - "-" "-" "-" "-" "-" BlackHoleCluster; - 240.240.0.159:5671 100.64.16.49:38522 - - - -
rabbitmq-test-1 istio-proxy [2025-02-25T19:38:07.171Z] "- - -" 0 UH "-" 0 0 0 - "-" "-" "-" "-" "-" BlackHoleCluster; - 240.240.0.159:5671 100.64.16.49:44192 - - - -

You can see istio is pairing the request out 5671 through the VIP assigned to the SE for 5672.

Even more interesting is if I disable this new DNS v2 stuff via putting networking.istio.io/enable-autoallocate-ip: "false" on the ServiceEntry as described here, everything goes back to working just fine.

TL;DR - Does DNS AutoAllocate V2 work with 2 ServiceEntries for the same TCP hostname, but going out different ports? My testing seems to say it doesn’t.

Version

istioctl version
client version: 1.23.0
istiod version: 1.22.5
istiod version: 1.22.5
istiod version: 1.22.5
istiod version: 1.24.2
istiod version: 1.24.2
istiod version: 1.24.2
data plane version: 1.24.2 (68 proxies)


kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.9-eks-8cce635

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 16 (9 by maintainers)

Most upvoted comments

it’s just how our helm template works; users put in egress rules in their values.yaml and we generate ServiceEntries per rule. There’s no technical reason we chose that approach, it’s just never bitten us until now so we’ve never had a reason to revisit it.

I’m having the user try to delete one of them, adding the config to the other one, to see if it works with just one.

  ports:
    - name: novarabbit
      number: 5672
      protocol: TCP
    - name: novarabbit
      number: 5671
      protocol: TCP
  resolution: DNS

I assume it prob will, since then it will be a single VIP? I’ll report back, stay tuned.

The issue here really is around: what is the behavior of two ServiceEntries for the same host?

This question has plagued Istio for years, in general (not specific to DNS capture v1/v2, ambient, etc) as it is extremely under-specified. You can see similar issues cropping up repeatedly (The description on https://github.com/istio/istio/pull/54207 covers a fraction of the issues we have seen!), and many tweaks to the merging semantics (https://github.com/istio/istio/pull/49595, https://github.com/istio/istio/pull/51776, etc).

Regardless of the DNS aspects, ambient itself just doesn’t handle merging of duplicated hostnames (https://github.com/istio/istio/issues/51863), so if we fix this for ambient we will need to address both codepaths (the DNS, to allocate a single VIP across the two resources, and the ambient codepath to merge the service).

so @howardjohn @ilrudie , we did what I described and that worked. So if this is expected behavior, we can close this. We will have to update our own helm chart to accommodate this.

It doesn’t explicitly state anywhere in Istio docs that ServiceEntries for a hostname over multiple ports must be in a single object, and it’s always worked for us in the previous 5+ Istio versions we’ve been on over the past 5 years, so I can see this biting other folks who upgrade to DNS V2 if they doing it like we do. Not sure what the solution is for that, if any…might be worth throwing a warning somewhere?

thanks for the help!