Can we configure Sidecar injection by type of workload

I have enabled automatic sidecar injection at time of pod creation but I want it only for type deployment and not for job in same name space .

The default policy can be overridden with the sidecar.istio.io/inject annotation in the pod template spec’s metadata . The deployment’s metadata is ignored. Annotation value of true forces the sidecar to be injected while a value of false forces the sidecar to not be injected.

The following annotation overrides whatever the default policy was to force the sidecar to be injected:

$ kubectl get deployment sleep -o yaml | grep "sidecar.istio.io/inject:" -C3
template:
  metadata:
    annotations:
      sidecar.istio.io/inject: "true"
    labels:
      app: sleep
1 Like