Policies fails on Istio injected containers (istio-init and istio-proxy) - how to exclude containers with specific names #270
-
Summary: Is it possible to make a exclude a policy from a container with a specific name? Hey everbody! I hope I can get some help. Our cluster is running with Istio and of course auto-injection of sidecars, which happens with a mutating webhook admission controller from Istio. As an example I have the policy disallow-capabilities-strict and in my Deployment of a given API I have the following configuration (in a slightly masked edition marked by ...):
As you can see I have two securityContext, one for the pod and one for the container. So my question is: Is it possible to make a exclude a policy from a container with a specific name? It at least possible with a pod with a specific label, but I would like to exclude some policies for containers with name istio-init and/or istio-proxy Thanks for any answers :-) Best regards |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
You should use a precondition using a JMESPath expression that simply skips the policy if a name of your choosing is found. |
Beta Was this translation helpful? Give feedback.
-
Has anyone resolved this elegantly? The concern with above is someone could name their container istio-init to get through the block. |
Beta Was this translation helpful? Give feedback.
-
https://kyverno.io/blog/2024/02/04/securing-services-meshes-easier-with-kyverno/ |
Beta Was this translation helpful? Give feedback.
https://kyverno.io/blog/2024/02/04/securing-services-meshes-easier-with-kyverno/