Hello,
Kubernetes documentation has following statement regarding service’s topologyKeys
field:
Note: This feature, specifically the alpha topologyKeys API, is deprecated since Kubernetes v1.21. Topology Aware Hints, introduced in Kubernetes v1.21, provide similar functionality.
The new mechanism is a different way of tackling kubernetes availability zones, but does not provide all functionality topologyKeys
did, especially with host-based routing.
Consider following example: in our kubernetes clusters we have a proxy meant to forward traffic to other nodes. This proxy runs as a DaemonSet
, so it is present on each node. Traffic to this proxy goes through ClusterIP
service containing following snippet:
spec:
topologyKeys:
- kubernetes.io/hostname
- '*'
With this configuration the traffic always reaches local instance of the proxy and then is forwarded to pods, possibly on other nodes. When current instance is not present, i.e during rolling update, the traffic originating from this node only is directed to other machines.
This works very well as it minimizes traffic between nodes and decreases latency. With heavy loaded nodes there is a significant gain. From kubernetes 1.22 on this is no more possible.
If we wanted to retain this optimization we would need to (ab)use new Topology Aware Hints labbeling each node with different zone. This would probably work in steady state, but during rolling update (or higher allocatable cpu differences) will disable optimization on all nodes.
Is there a better way of doing this? Will Topology Aware Hints support host-based routing in addition to zoned one?
Or maybe using such optimizations is considered a bad practice and should be avoided?
I’m looking for general advice on this topic as I’m hesitating to create a GitHub issue in kubernetes project?
–
Regards,
Bartosz Borkowski