Audit security posture
What you’ll accomplish
Section titled “What you’ll accomplish”You’ll review your cluster’s security posture by auditing policy exemptions for scope and justification, and inspecting Package CR network rules for overly permissive configurations.
Prerequisites
Section titled “Prerequisites”- UDS CLI installed
- Access to a Kubernetes cluster with UDS Core deployed
Before you begin
Section titled “Before you begin”UDS Core provides two layers of auditable security configuration:
- Policy exemptions - Exemption CRs that allow specific workloads to bypass UDS policies. Each exempted resource is annotated, creating a built-in audit trail.
- Package CR network rules - The
allowfields in Package CRs generate Kubernetes NetworkPolicies and Istio AuthorizationPolicies. Overly broad rules can silently weaken your network segmentation.
-
Review active exemptions
List all Exemption CRs and check their scope:
Terminal window # List exemptions in the default namespaceuds zarf tools kubectl get exemptions -n uds-policy-exemptions -o yaml# If all-namespace exemptions are enabled, check everywhereuds zarf tools kubectl get exemptions -A -o yamlFor each exemption, verify:
- Justification - Does the
titleanddescriptionexplain why the exemption is needed? - Scope - Is the
matcher.nameregex as narrow as possible? A regex like".*"exempts every resource in the namespace. - Policies - Are only the minimum required policies listed? For example, an exemption for
DisallowPrivilegedshould not also includeDropAllCapabilitiesunless both are genuinely needed. - Staleness - Does the target workload still exist? Exemptions are not automatically cleaned up when workloads are removed.
- Justification - Does the
-
Find all exempted resources in the cluster
Query pod and service annotations to build a cluster-wide view of every exempted resource:
Terminal window # Exempted podsuds zarf tools kubectl get pods -A -o yaml | \uds zarf tools yq '.items[] | select((.metadata.annotations // {}) | to_entries[] | select(.value == "exempted")) | .metadata.namespace + "/" + .metadata.name + ": " + ((.metadata.annotations // {}) | to_entries[] | select(.value == "exempted") | .key)' | sort -u# Exempted servicesuds zarf tools kubectl get services -A -o yaml | \uds zarf tools yq '.items[] | select((.metadata.annotations // {}) | to_entries[] | select(.value == "exempted")) | .metadata.namespace + "/" + .metadata.name + ": " + ((.metadata.annotations // {}) | to_entries[] | select(.value == "exempted") | .key)' | sort -uThis produces output like:
monitoring/node-exporter: uds-core.pepr.dev/uds-core-policies.DisallowHostNamespacesmonitoring/node-exporter: uds-core.pepr.dev/uds-core-policies.RequireNonRootUseristio-admin-gateway/admin-ingressgateway: uds-core.pepr.dev/uds-core-policies.DisallowNodePortServicesCross-reference this list against your Exemption CRs. Every exempted resource should map back to a documented, justified exemption.
-
Audit Package CR network allow rules
List all Package CRs and inspect their network rules:
Terminal window # List all packages across namespacesuds zarf tools kubectl get packages -A# Inspect a specific package's network rulesuds zarf tools kubectl get package <name> -n <namespace> -o yaml | uds zarf tools yq '.spec.network.allow'Flag these patterns in
allowrules:Pattern Risk What to check remoteGenerated: AnywhereAllows traffic to/from any external IP Is this egress rule scoped to specific ports? Does the app genuinely need arbitrary external access? Empty selector: {}Rule applies to all pods in the namespace Should this target specific pods instead? Broad remoteNamespacewithoutremoteSelectorAllows traffic from all pods in the remote namespace Can this be narrowed to specific pods or a service account? Missing porton an allow ruleAllows traffic on all ports Should specific ports be listed? remoteHostegress without justificationOpens egress to a specific external hostname Is the hostname documented and expected? -
Verify Pepr controller health
Confirm the policy controller is running and processing resources:
Terminal window # Check Pepr system podsuds zarf tools kubectl get pods -n pepr-system# Verify admission webhooks are registereduds zarf tools kubectl get mutatingwebhookconfigurations,validatingwebhookconfigurations | grep pepr
Verification
Section titled “Verification”A well-audited cluster shows:
- All
pepr-systempods areRunningandReady - Every Exemption CR has a
titleanddescriptionwith clear justification - No exemptions target removed workloads
- No Package CR
allowrules useremoteGenerated: Anywherewithout documented justification
Related Documentation
Section titled “Related Documentation”- Policy Engine - full reference of all enforced policies
- Exemption CR specification - full CR schema and field reference
- Package CR specification - full Package CR schema including network fields
Next steps
Section titled “Next steps”These guides and concepts may be useful to explore next: