List templates and active constraints

Show all ConstraintTemplates and every constraint created from them in all namespaces.

kubectl get constrainttemplates && kubectl get constraints -A

tool
opa-gatekeeper3 commands
tags
opa-gatekeepersecurityk8sgitops

More opa-gatekeeper commands

  • kubectl get k8srequiredlabels <name> -o jsonpath='{.status.totalViolations} {range .status.violations[*]}{"\n"}{.kind}/{.name}: {.message}{end}'

    Read the violation count and offending resources from the constraint's audit status, no new scan needed.

  • gator test -f policy/ && gator verify ./suite

    Test templates and constraints against fixtures without a cluster, so policy mistakes show up in CI before deploy.

all 3 opa-gatekeeper commands