TIS0002 - Multiple configuration objects applied to the same workload
More than one configuration object (e.g., PeerAuthentication
, RequestAuthentication
, Telemetry
, and Sidecar
) is applied to the same workload.
By consolidating multiple configuration objects into single, unified configurations, you can ensure consistent behavior and reduce the risk of conflicts or unintended side effects in your Istio service mesh.
Examples
-
Multiple
PeerAuthentication
Objects with Overlapping SelectorsFirst
PeerAuthentication
Object:apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: mtls-strict
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
mtls:
mode: STRICTSecond
PeerAuthentication
Object:apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: mtls-permissive
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
version: v1
mtls:
mode: PERMISSIVEExplanation: Both policies apply to the
my-service
workload, specificallyversion: v1
. The first policy targets all versions ofmy-service
, while the second specifically targetsversion: v1
. This overlap can cause conflicts in mTLS settings for thev1
pods. -
Multiple
RequestAuthentication
Objects with Overlapping SelectorsFirst
RequestAuthentication
Object:apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: jwt-auth
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
jwtRules:
- issuer: "https://secure.token.service"
jwksUri: "https://secure.token.service/.well-known/jwks.json"Second
RequestAuthentication
Object:apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: another-jwt-auth
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
jwtRules:
- issuer: "https://another.token.service"
jwksUri: "https://another.token.service/.well-known/jwks.json"Explanation: Both policies apply to the same workload, causing it to validate JWTs from multiple issuers. This can lead to authentication conflicts and unintended access behavior.
-
Multiple
Telemetry
Objects with Overlapping SelectorsFirst
Telemetry
Object:apiVersion: telemetry.istio.io/v1alpha1
kind: Telemetry
metadata:
name: telemetry-logging
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
accessLogging:
- disabled: falseSecond
Telemetry
Object:apiVersion: telemetry.istio.io/v1alpha1
kind: Telemetry
metadata:
name: telemetry-metrics
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
metrics:
- disabled: trueExplanation: Both telemetry configurations target
my-service
, but they configure different aspects (logging and metrics). Managing multiple telemetry objects can cause confusion and inconsistent telemetry data.
Recommendation
If feasible, merge these objects into a single configuration.
-
Consolidate
PeerAuthentication
ObjectsMerged
PeerAuthentication
Object:apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: mtls-settings
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
mtls:
mode: STRICT
portLevelMtls:
8080:
mode: PERMISSIVEExplanation: By merging policies, you can specify both global and port-level mTLS settings within a single configuration, reducing the potential for conflict.
-
Consolidate
RequestAuthentication
ObjectsMerged
RequestAuthentication
Object:apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: jwt-auth-combined
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
jwtRules:
- issuer: "https://secure.token.service"
jwksUri: "https://secure.token.service/.well-known/jwks.json"
- issuer: "https://another.token.service"
jwksUri: "https://another.token.service/.well-known/jwks.json"Explanation: Combining JWT rules into a single policy simplifies authentication configuration and reduces the risk of conflicting rules.
-
Consolidate
Telemetry
ObjectsMerged
Telemetry
Object:apiVersion: telemetry.istio.io/v1alpha1
kind: Telemetry
metadata:
name: telemetry-settings
namespace: example-namespace
spec:
selector:
matchLabels:
app: my-service
accessLogging:
- disabled: false
metrics:
- disabled: trueExplanation: Merging telemetry configurations ensures consistent behavior and simplifies management of telemetry data collection.