TIS0201 - Multiple DestinationRule
Objects for Same Host-Subset Combination
Multiple DestinationRule
objects exist for the same host-subset combination.
DestinationRule
ConfigurationsTo ensure consistent routing behavior, avoid overlapping configurations in multiple DestinationRule
objects. Either combine the settings into a single rule or use distinct subsets for different configurations.
Examples
-
Two
DestinationRule
Objects Targeting the Same Host and SubsetFirst
DestinationRule
:apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: destination-rule-1
namespace: example-namespace
spec:
host: "my-service.example-namespace.svc.cluster.local"
subsets:
- name: v1
labels:
version: v1
trafficPolicy:
loadBalancer:
simple: ROUND_ROBINSecond
DestinationRule
:apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: destination-rule-2
namespace: example-namespace
spec:
host: "my-service.example-namespace.svc.cluster.local"
subsets:
- name: v1
labels:
version: v1
trafficPolicy:
loadBalancer:
simple: LEAST_CONNExplanation: Both
DestinationRule
objects define subsets for the same host,my-service.example-namespace.svc.cluster.local
, and the same subset (v1
). This overlap can cause unpredictable routing behavior, as Istio may be unable to resolve which rule should be applied. -
Conflicting
DestinationRule
SubsetsFirst
DestinationRule
:apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: rule-1
namespace: example-namespace
spec:
host: "my-service"
subsets:
- name: blue
labels:
env: blue
trafficPolicy:
connectionPool:
http:
maxRequestsPerConnection: 100Second
DestinationRule
:apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: rule-2
namespace: example-namespace
spec:
host: "my-service"
subsets:
- name: blue
labels:
env: blue
trafficPolicy:
connectionPool:
http:
maxRequestsPerConnection: 200Explanation: Both rules define different traffic policies for the same subset (
blue
). This results in conflicting settings formaxRequestsPerConnection
, leading to inconsistent routing and connection pool behavior.
Recommendation
Combine the settings into a single DestinationRule
or split the subsets to avoid overlap, ensuring consistent routing behavior.
-
Combine
DestinationRule
SettingsCombine both
DestinationRule
configurations into a singleDestinationRule
to avoid conflicts and ensure consistent behavior.apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: combined-destination-rule
namespace: example-namespace
spec:
host: "my-service.example-namespace.svc.cluster.local"
subsets:
- name: v1
labels:
version: v1
trafficPolicy:
loadBalancer:
simple: LEAST_CONN -
Split Subsets to Avoid Overlapping
Ensure that subsets are uniquely defined across
DestinationRule
objects to prevent overlap.apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: rule-1
namespace: example-namespace
spec:
host: "my-service"
subsets:
- name: blue
labels:
env: blue
trafficPolicy:
connectionPool:
http:
maxRequestsPerConnection: 100apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: rule-2
namespace: example-namespace
spec:
host: "my-service"
subsets:
- name: green
labels:
env: green
trafficPolicy:
connectionPool:
http:
maxRequestsPerConnection: 200