v1.21 Cannot query multi-port services in v1.22
Author: jameshartigCreated Aug 11, 2026Updated Aug 17, 2026
Overview of the Issue
If a service is defined in v1.22 with:
"Ports": [
{
"Name": "http",
"Port": 8080,
"Default": true
}
]This ends up breaking anything querying against it in v1.21 because it is looking for port but there is no port.
This is handled in some places with code like:
if clone.ServicePort == 0 && len(clone.ServicePorts) > 0 {
// Populate `port` with default port for backward compatibility
clone.ServicePort = clone.ToNodeService().DefaultPort()
}But crucially, this isn't handled in the RPC methods like Catalog.NodeServices so if you try to do a DNS SRV lookup you end up getting 0 port.
Reproduction Steps
Consul info for both Client and Server
N/A
Operating system and Environment details
v1.22.x is running in k8s and we noticed this because consul-k8s switched to only set Ports and no longer sets Port.
Log Fragments
Source: hashicorp/consul