Create UDS policy exemptions
What you’ll accomplish
Section titled “What you’ll accomplish”You’ll create a UDS Exemption CR to allow a workload to bypass specific UDS policies when a code-level fix isn’t possible.
Prerequisites
Section titled “Prerequisites”- UDS CLI installed
- Access to a Kubernetes cluster with UDS Core deployed
- The exemption policy names for your workload (see Policy Engine reference)
Before you begin
Section titled “Before you begin”UDS Core uses Pepr to enforce policies on every resource submitted to the cluster. When a workload legitimately requires behavior that policy blocks (for example, a privileged DaemonSet for node-level monitoring), you can create an Exemption CR to bypass specific policies for targeted resources.
-
Create the Exemption CR manifest
Each exemption specifies which policies to bypass (see the Policy Engine reference for exemption names) and a matcher that targets specific resources:
exemption.yaml apiVersion: uds.dev/v1alpha1kind: Exemptionmetadata:name: my-app-exemptionsnamespace: uds-policy-exemptionsspec:exemptions:- policies:- DisallowPrivileged- RequireNonRootUsermatcher:namespace: my-namespacename: "^my-privileged-pod.*"kind: podtitle: "Privileged monitoring agent"description: "Requires privileged access for node-level metrics collection"Matcher fields:
Field Description Required namespaceNamespace of the target resource Yes nameResource name (supports regex, e.g., "^my-pod.*")Yes kindResource kind: podorservice(defaults topod)No -
(Optional) Add multiple exemption entries
A single Exemption resource can contain multiple entries targeting different policies and matchers:
exemption.yaml apiVersion: uds.dev/v1alpha1kind: Exemptionmetadata:name: my-app-exemptionsnamespace: uds-policy-exemptionsspec:exemptions:- policies:- DisallowPrivileged- RequireNonRootUsermatcher:namespace: my-namespacename: "^my-privileged-pod.*"title: "Privileged agent"description: "Requires privileged access for node-level metrics collection"- policies:- DisallowNodePortServicesmatcher:namespace: my-namespacename: "^my-nodeport-svc.*"kind: servicetitle: "NodePort service"description: "Exposed via NodePort for external load balancer integration" -
Deploy the Exemption
(Recommended) Include the Exemption manifest in your Zarf package and create/deploy. See Packaging applications for general packaging guidance.
Terminal window uds zarf package create --confirmuds zarf package deploy zarf-package-*.tar.zst --confirmOr apply the Exemption directly for quick testing:
Terminal window uds zarf tools kubectl apply -f exemption.yaml
Verification
Section titled “Verification”After deploying the exemption, confirm it is active and your workload is running:
# Verify the Exemption CR existsuds zarf tools kubectl get exemptions -n uds-policy-exemptions
# Check that the target pod has the exemption annotationuds zarf tools kubectl get pod <pod-name> -n <namespace> -o yaml | \ uds zarf tools yq '(.metadata.annotations // {}) | to_entries[] | select(.value == "exempted")'
# Verify pods are runninguds zarf tools kubectl get pods -n <namespace>Success criteria:
- All pods are
RunningandReady - Exempted pods show
uds-core.pepr.dev/uds-core-policies.<POLICY>: exemptedannotations - No admission webhook denial events
Troubleshooting
Section titled “Troubleshooting”Problem: Exemption not taking effect
Section titled “Problem: Exemption not taking effect”Symptom: The workload is still blocked despite an Exemption CR being deployed.
Solution: Verify the following:
- The Exemption CR is in the
uds-policy-exemptionsnamespace (or all-namespace exemptions are enabled) - The
matcher.namespacematches the workload’s namespace exactly - The
matcher.nameregex matches the resource name. Test your regex against the actual pod/service name. - The
matcher.kindis correct (podfor pods,servicefor services)
If the exemption exists but still isn’t being applied, see the Exemptions & Packages Not Updating runbook for detailed diagnostics.
Related Documentation
Section titled “Related Documentation”- Policy Engine - full reference of all enforced policies, severity levels, and blocked annotations
- Exemption CR specification - full CR schema and field reference
- Policy Violations runbook - diagnose and fix admission failures and unexpected mutations
Next steps
Section titled “Next steps”These guides and concepts may be useful to explore next: