Skip to main content

Why does PreferSameZone treat cloud and bare-metal nodes in one location as different zones?

Syself support For release

Cloud and bare-metal nodes in the same Hetzner location have different topology.kubernetes.io/zone labels. For example, a cloud node in Falkenstein uses fsn1-dc14, while a bare-metal node uses fsn1. Kubernetes uses these labels to determine which nodes belong to the same zone, so it treats them as being in different zones.

Location Zone on a cloud node Zone on a bare-metal node
Falkenstein fsn1-dc14 fsn1
Nuremberg nbg1-dc3 nbg1
Helsinki hel1-dc2 hel1

In a cluster that runs both node types in the same location, PreferSameZone and PreferClose route traffic from cloud nodes only to cloud endpoints, and traffic from bare-metal nodes only to bare-metal endpoints. If the client's zone has no endpoint, traffic can go to any endpoint of the Service, including endpoints in other locations.

Clusters with only cloud nodes or only bare-metal nodes are not affected because all nodes in a location have the same zone label.

Topology spread constraints and affinity rules that use topology.kubernetes.io/zone also use these same zone values.

Do not use PreferSameZone, PreferClose or the service.kubernetes.io/topology-mode annotation. Use trafficDistribution: PreferSameNode instead. See Route Service traffic with trafficDistribution for setup instructions.

Still stuck?

Prepare your case, then email us.