Interview Prep/DevSecOps/Kubernetes admission control and Pod Security

Gatekeeper policy that checks "Ingress host must be unique" never fires

AdvancedTroubleshootingKubernetes admission control and Pod Security
Answer

Likely causes → Policies referencing other objects use data.inventory, which is empty unless you configure Gatekeeper to sync those kinds.

Diagnose → kubectl get config config -n gatekeeper-system -o yaml and check spec.sync.syncOnly.

Fix →

apiVersion: config.gatekeeper.sh/v1alpha1
kind: Config
metadata: { name: config, namespace: gatekeeper-system }
spec:
  sync:
    syncOnly:
    - { group: "networking.k8s.io", version: "v1", kind: "Ingress" }

Prevent → Document data dependencies next to each ConstraintTemplate and test with replicated inventory in gator verify.

All DevSecOps questions Roadmap: Policy as code

More on Kubernetes admission control and Pod Security