Interview Prep/DevSecOps/Kubernetes admission control and Pod Security

Kyverno `generate` policy for a default-deny NetworkPolicy created it in new namespaces, but someone deleted it and it did not come back

IntermediateTroubleshootingKubernetes admission control and Pod Security
Answer

Likely causes → synchronize: false in the generate rule, so Kyverno does not keep the downstream resource in sync.

Diagnose → kubectl get clusterpolicy add-default-deny -o yaml | yq '.spec.rules[].generate.synchronize'

Fix → Set synchronize: true; Kyverno recreates deleted resources and reverts edits.

Prevent → Restrict RBAC on NetworkPolicy deletion in tenant namespaces and alert on deletes from audit logs.

All DevSecOps questions Roadmap: Policy as code

More on Kubernetes admission control and Pod Security