Gatekeeper `audit` reports violations for resources that no longer exist
IntermediateTroubleshootingKubernetes admission control and Pod Security
Answer
Likely causes → Audit results are refreshed on an interval (default 60s) and capped by --constraint-violations-limit; status can lag, or audit pods are failing.
Diagnose →
kubectl -n gatekeeper-system logs deploy/gatekeeper-audit | tail
kubectl get k8srequiredlabels require-team -o jsonpath='{.status.auditTimestamp}'
Fix → Fix the audit pod (memory limits are a common cause on big clusters) and wait for the next cycle.
Prevent → Size audit resources for cluster object count and use --audit-from-cache with sync config for what you query.
More on Kubernetes admission control and Pod Security
`Error from server: admission webhook "validate.kyverno.svc-fail" denied the request: policy Deployment/prod/api for resource violation: require-run-as-nonroot`BeginnerPods do not appear, but `kubectl apply` of the Deployment succeededBeginner`pods "api-7d9" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false, unrestricted capabilities, seccompProfile`BeginnerEnabling `enforce=restricted` on a namespace did not evict the existing non-compliant podsBeginner`Error from server (InternalError): Internal error occurred: failed calling webhook "validation.gatekeeper.sh": ... context deadline exceeded` blocks every deployIntermediateKyverno is down and now the whole cluster, including Kyverno's own namespace, cannot be fixed because writes are rejectedAdvanced