Allow exemptions in all namespaces
What you’ll accomplish
Section titled “What you’ll accomplish”You’ll configure UDS Core to accept Exemption CRs in any namespace instead of only the default uds-policy-exemptions namespace, and verify the configuration works.
Prerequisites
Section titled “Prerequisites”- UDS CLI installed
- Access to a Kubernetes cluster with prerequisites met
- Familiarity with Kubernetes RBAC
Before you begin
Section titled “Before you begin”By default, Exemption CRs are only accepted in the uds-policy-exemptions namespace. This provides a single, controlled location where platform engineers manage all policy exemptions. Enabling all-namespace exemptions allows teams to manage their own exemptions in their application namespaces.
-
Enable all-namespace exemptions
Set the
ALLOW_ALL_NS_EXEMPTIONSvariable in youruds-config.yaml:uds-config.yaml variables:core:ALLOW_ALL_NS_EXEMPTIONS: "true" -
Create and deploy your bundle
Terminal window uds create --confirm && uds deploy uds-bundle-*.tar.zst --confirm
Verification
Section titled “Verification”Create a test Exemption CR in an application namespace to confirm the configuration is working:
apiVersion: uds.dev/v1alpha1kind: Exemptionmetadata: name: test-exemption namespace: my-appspec: exemptions: - policies: - RequireNonRootUser matcher: namespace: my-app name: "^test-pod.*" title: "Test exemption" description: "Verifying all-namespace exemptions are working"uds zarf tools kubectl apply -f test-exemption.yamlConfirm the exemption was created and processed:
# Verify the Exemption CR exists in the application namespaceuds zarf tools kubectl get exemptions -n my-app
# Check Pepr logs for processinguds zarf tools kubectl logs -n pepr-system deploy/pepr-uds-core --tail=50 | grep "Processing exemption"Clean up the test exemption:
uds zarf tools kubectl delete exemption test-exemption -n my-appTroubleshooting
Section titled “Troubleshooting”Problem: Exemption rejected in application namespace
Section titled “Problem: Exemption rejected in application namespace”Symptom: Creating an Exemption CR outside uds-policy-exemptions returns a validation error.
Solution: Verify that ALLOW_ALL_NS_EXEMPTIONS is set to "true" and that the Core bundle was redeployed after the change. Check the UDS Operator config:
uds zarf tools kubectl get clusterconfig uds-cluster-config -o jsonpath='{.spec.policy}'Related Documentation
Section titled “Related Documentation”- Exemption CR specification - full CR schema and field reference
- Kubernetes RBAC documentation - securing who can create Exemption resources
Next steps
Section titled “Next steps”These guides and concepts may be useful to explore next: