# Workflow - OPA Gatekeeper Policy Enforcement ## Phase 1: Install Gatekeeper ```bash helm repo add gatekeeper https://open-policy-agent.github.io/gatekeeper/charts helm repo update helm install gatekeeper gatekeeper/gatekeeper \ --namespace gatekeeper-system --create-namespace \ --set replicas=3 --set audit.replicas=1 kubectl -n gatekeeper-system rollout status deployment/gatekeeper-controller-manager ``` ## Phase 2: Deploy ConstraintTemplates ```bash # Clone Gatekeeper policy library git clone https://github.com/open-policy-agent/gatekeeper-library.git # Apply common templates kubectl apply -f gatekeeper-library/library/pod-security-policy/privileged-containers/template.yaml kubectl apply -f gatekeeper-library/library/pod-security-policy/host-namespaces/template.yaml kubectl apply -f gatekeeper-library/library/pod-security-policy/allow-privilege-escalation/template.yaml kubectl apply -f gatekeeper-library/library/general/allowedrepos/template.yaml kubectl apply -f gatekeeper-library/library/general/requiredlabels/template.yaml kubectl apply -f gatekeeper-library/library/general/containerlimits/template.yaml ``` ## Phase 3: Deploy Constraints in Dryrun Mode ```bash kubectl apply -f - <