You specify the path for traffic with routing rules, and then you use destination rules to configure the set of policies that Envoy proxies apply to a request at a specific destination. Destination rules are applied after the routing rules are evaluated.
Configurations you set in destination rules apply to traffic that you route through your platform’s basic connectivity. You can use wildcard prefixes in a destination rule to specify a single rule for multiple services.
You can use destination rules to specify service subsets, that is, to group all the instances of your service with a particular version together. You then configure routing rules that route traffic to your subsets to send certain traffic to particular service versions.
You specify explicit routing rules to service subsets. This model allows you to:
Cleanly refer to a specific service version across different virtual services.
Simplify the stats that the Istio proxies emit.
Encode subsets in Server Name Indication (SNI) headers.
Load balancing 3 subsets
The following example destination rule configures three different subsets with
different load balancing policies for the
my-svc destination service:
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: name: my-destination-rule spec: host: my-svc trafficPolicy: loadBalancer: simple: RANDOM subsets: - name: v1 labels: version: v1 - name: v2 labels: version: v2 trafficPolicy: loadBalancer: simple: ROUND_ROBIN - name: v3 labels: version: v3
As shown above, you can specify multiple policies in a single destination rule.
In this example, the default policy is defined above the
subsets: field. The
v2 specific policy is defined in the corresponding subset’s field. The
following diagram shows how the different configurations in the
my-destination-rule destination rule and in the routing rules in
virtual service would apply to the traffic to and from the
Visit our destination rules reference documentation to review all the enabled keys and values.
Service subsets subdivide and label the instances of a service. To define the
divisions and labels, use the
subsets: section in destination rules.
For example, you can use subsets to configure the following traffic routing
Use subsets to route traffic to different versions of a service.
Use subsets to route traffic to the same service in different environments.
Understanding service subsets in Istio allows you to configure the communication to services with multiple versions within your mesh and configure the following common use cases:
To learn how you can use service subsets to configure failure handling use cases, visit our Network resilience and testing concept.