TIS0003 - No workload matches the specified selector in this namespace
No workload matches the specified selector in this namespace.
By ensuring that your policy selectors match existing workloads, you can apply configurations effectively and avoid unnecessary or ineffective policy objects in your Istio service mesh.
Examples
-
PeerAuthentication
with Non-Matching SelectorapiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: mtls-policy
namespace: example-namespace
spec:
selector:
matchLabels:
app: non-existent-app
mtls:
mode: STRICTExplanation: The
PeerAuthentication
policy is targeting workloads with the labelapp: non-existent-app
, but no such workloads exist in theexample-namespace
. Therefore, the policy has no effect. -
RequestAuthentication
with Non-Matching SelectorapiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: jwt-auth
namespace: example-namespace
spec:
selector:
matchLabels:
app: missing-service
jwtRules:
- issuer: "https://secure.token.service"
jwksUri: "https://secure.token.service/.well-known/jwks.json"Explanation: The
RequestAuthentication
policy specifies a selector forapp: missing-service
, but no workloads in the namespace have this label, rendering the policy ineffective. -
Telemetry
with Non-Matching SelectorapiVersion: telemetry.istio.io/v1alpha1
kind: Telemetry
metadata:
name: telemetry-settings
namespace: example-namespace
spec:
selector:
matchLabels:
app: unknown-app
accessLogging:
- disabled: falseExplanation: The
Telemetry
configuration is intended for workloads labeledapp: unknown-app
, but such workloads do not exist in the namespace, so the telemetry settings are not applied to any workload.
Recommendation
Modify the labels to match an existing workload, deploy a compatible workload, or remove the object.
-
Modify the Selector to Match Existing Workloads
If you intended to apply the policy to an existing workload, update the selector to match the labels of that workload.
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: mtls-policy
namespace: example-namespace
spec:
selector:
matchLabels:
app: existing-app
mtls:
mode: STRICT -
Add Labels to Workloads to Match the Selector
If you intended to apply the policy to a workload but it lacks the necessary labels, add the appropriate labels to the workload.
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-service
namespace: example-namespace
labels:
app: non-existent-app
spec:
replicas: 1
selector:
matchLabels:
app: non-existent-app
template:
metadata:
labels:
app: non-existent-app
spec:
containers:
- name: my-container
image: my-image -
Remove Unused Policy Objects
If the policy is not needed, consider removing it to clean up your configuration.
kubectl delete peerauthentication mtls-policy -n example-namespace