You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
introduced in Kubernetes v1.21, provide similar functionality.
26
21
27
22
{{</ note >}}
28
23
@@ -32,33 +27,32 @@ preferentially routed to endpoints that are on the same Node as the client, or
32
27
in the same availability zone.
33
28
34
29
35
-
36
30
<!-- body -->
37
31
38
-
## Introduction
32
+
## Topology-aware traffic routing
39
33
40
34
By default, traffic sent to a `ClusterIP` or `NodePort` Service may be routed to
41
-
any backend address for the Service. Since Kubernetes 1.7 it has been possible
42
-
to route "external" traffic to the Pods running on the Node that received the
43
-
traffic, but this is not supported for `ClusterIP` Services, and more complex
44
-
topologies — such as routing zonally — have not been possible. The
45
-
_Service Topology_ feature resolves this by allowing the Service creator to
46
-
define a policy for routing traffic based upon the Node labels for the
47
-
originating and destination Nodes.
48
-
49
-
By using Node label matching between the source and destination, the operator
50
-
may designate groups of Nodes that are "closer" and "farther" from one another,
51
-
using whatever metric makes sense for that operator's requirements. For many
52
-
operators in public clouds, for example, there is a preference to keep service
53
-
traffic within the same zone, because interzonal traffic has a cost associated
54
-
with it, while intrazonal traffic does not. Other common needs include being able
55
-
to route traffic to a local Pod managed by a DaemonSet, or keeping traffic to
56
-
Nodes connected to the same top-of-rack switch for the lowest latency.
57
-
35
+
any backend address for the Service. Kubernetes 1.7 made it possible to
36
+
route "external" traffic to the Pods running on the same Node that received the
37
+
traffic. For `ClusterIP` Services, the equivalent same-node preference for
38
+
routing wasn't possible; nor could you configure your cluster to favor routing
39
+
to endpoints within the same zone.
40
+
By setting `topologyKeys` on a Service, you're able to define a policy for routing
41
+
traffic based upon the Node labels for the originating and destination Nodes.
42
+
43
+
The label matching between the source and destination lets you, as a cluster
44
+
operator, designate sets of Nodes that are "closer" and "farther" from one another.
45
+
You can define labels to represent whatever metric makes sense for your own
46
+
requirements.
47
+
In public clouds, for example, you might prefer to keep network traffic within the
48
+
same zone, because interzonal traffic has a cost associated with it (and intrazonal
49
+
traffic typically does not). Other common needs include being able to route traffic
50
+
to a local Pod managed by a DaemonSet, or directing traffic to Nodes connected to the
51
+
same top-of-rack switch for the lowest latency.
58
52
59
53
## Using Service Topology
60
54
61
-
If your cluster has Service Topology enabled, you can control Service traffic
55
+
If your cluster has the `ServiceTopology`[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) enabled, you can control Service traffic
62
56
routing by specifying the `topologyKeys` field on the Service spec. This field
63
57
is a preference-order list of Node labels which will be used to sort endpoints
64
58
when accessing this Service. Traffic will be directed to a Node whose value for
@@ -209,4 +203,3 @@ spec:
209
203
* Read about [enabling Service Topology](/docs/tasks/administer-cluster/enabling-service-topology)
210
204
* Read [Connecting Applications with Services](/docs/concepts/services-networking/connect-applications-service/)
0 commit comments