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 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 "" -C3
    annotations: "true"
      app: sleep
1 Like