|
| 1 | +# DestinationRule |
| 2 | + |
| 3 | +After a destination Service is chosen by a `VirtualService` (the request is routed), a `DestinationRule` specifies how that Service should be talked to. |
| 4 | + |
| 5 | +> In this directory, "endpoint pool" means the set of endpoints to which traffic has been routed; a Service or a Subset of a Service |
| 6 | +
|
| 7 | +It describes how to load balance between the network endpoints of the Service (as found in the Service Registry). |
| 8 | +It also says how connections should be made to those network endpoints (HTTP version, TLS stance) and how they should be managed (keep-alive times, maximum active connections to load-balance onto any individual endpoint at once). |
| 9 | + |
| 10 | +`DestinationRules` configure the _client_ sidecars, eg for the flow `service-a -> sidecar-a -> sidecar-b -> service-b` the `DestinationRule` for host "service-b" configures each instance of "sidecar-a". |
| 11 | +Thus the connection options technically configure how "sidecar-a" talks to _"sidecar-b"_ (if the destination is also in the mesh, or directly to the service or whatever proxies are in front of it if it's not). |
| 12 | +The only time to bear in mind that you're talking to the server's sidecar rather than the actual "app" is when considering TLS, as the server sidecar will terminate this. |
| 13 | +There is no way to configure the behaviour from "sidecar-b" to "service-b"; this is basically a passthrough, except the mutual TLS upgrade noted above. |
| 14 | + |
| 15 | +`DestinationRules` are implemented locally by each sidecar; there is no global coordination between sidecars. |
| 16 | +For example |
| 17 | +* circuit-breaker detection and elimination is done per client sidecar; each holds their own state for this which might differ from other sidecars' |
| 18 | + |
| 19 | +`DestinationRules` configure how one client should talk to the _pool_ of endpoints (a Service or subset of a Service). |
| 20 | +For example |
| 21 | +* load-balancer config controls how each individual client should pick one of the _n_ servers (endpoint instances) each time there's a new outbound connection |
| 22 | +* circuit-breaking applies across the pool (of servers); it temporarily removes instances from the pool (even if Service Discovery says they're healthy thus they're in the service registry) |
| 23 | +* TLS config applies to all connections from the client to any server (in the pool) |
| 24 | +The exception is connection-pool settings, which apply to each client-server pair individually. |
| 25 | +Recall though that they apply to `sidecar-a -> sidecar-b`, not `sidecar-b -> service-b`. |
| 26 | + |
| 27 | +It also somewhat confusingly details the Subsets of the Service available as routing targets in `VirtualServices`. |
| 28 | +You might think this would be on something like a `ServiceEntry` resource that obviously manipulates the Service Registry. |
| 29 | +However, `DestinationRule` settings can be per-subset (as they're different workload binaries and might need treating differently). |
0 commit comments