Policy decision
{"rule":"no-latest-tag","mode":"enforce","owner":"platform-security","exception":{"required":true,"max_days":14}}- Policy semantics and ownership are explicit.
- An exception path exists but cannot silently become permanent.
Encode organizational requirements as early feedback and runtime admission guardrails, distinguishing defaulting, warning, auditing and enforcement while maintaining accountable exceptions.
A platform should prevent known-bad configurations where appropriate and give developers fast, specific feedback. Manual approval for every normal request usually becomes a bottleneck rather than a control.
Pod Security Admission can enforce Pod Security Standards at namespace scope. ValidatingAdmissionPolicy can express CEL-based validation, while admission webhooks can support more complex checks. Choose the simplest control that matches the requirement.
A justified exception needs narrow scope, accountable owner, expiry and compensating controls. Permanent anonymous bypasses turn policy into theater.
Admission and deployment policy can require evidence such as immutable digests, approved registries, signatures or provenance references. The platform should surface a specific denial reason and an accountable exception path rather than forcing developers to reverse-engineer a generic forbidden response.
{"rule":"no-latest-tag","mode":"enforce","owner":"platform-security","exception":{"required":true,"max_days":14}}Goal: Validate workload requests against simple platform policy and an expiring exception model.
cat > /tmp/policy-request.json <<'EOF'
{"image":"registry/orders@sha256:abc123","privileged":false,"owner":"payments","exception_expires_days":0}
EOFpython3 - <<'PY2'
import json
x=json.load(open('/tmp/policy-request.json'))
assert '@sha256:' in x['image']
assert x['privileged'] is False
assert x['owner']
assert 0 <= x['exception_expires_days'] <= 14
print('policy pass')
PY2Change the image to a mutable :latest tag and explain the developer-facing remediation message.
Platform guardrails reduce repeated review work when they are predictable, actionable and measurable.
Install a tagged Kyverno release in the disposable kind cluster, apply an enforce-mode policy, and experience an admission denial with actionable feedback.
./ops/setup-platform-kind-lab.shKYVERNO_VERSION=${KYVERNO_VERSION:-v1.16.2}; kubectl --context kind-gnu-platform-lab apply --server-side --force-conflicts -f "https://github.com/kyverno/kyverno/releases/download/${KYVERNO_VERSION}/install.yaml"kubectl --context kind-gnu-platform-lab -n kyverno wait --for=condition=Available deployment --all --timeout=240scat <<'EOF' | kubectl --context kind-gnu-platform-lab apply -f -
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-platform-owner
spec:
rules:
- name: require-owner-label
match:
any:
- resources:
kinds: [Pod]
namespaces: [platform-lab]
validate:
failureAction: Enforce
message: platform.gnu.group/owner label is required
pattern:
metadata:
labels:
platform.gnu.group/owner: '?*'
EOFkubectl --context kind-gnu-platform-lab -n platform-lab run denied-demo --image=nginx:alpine --restart=Neverkubectl --context kind-gnu-platform-lab -n platform-lab run allowed-demo --image=nginx:alpine --restart=Never --labels=platform.gnu.group/owner=paymentsThree concept checks plus one scenario check.
An automated boundary/default that keeps common self-service within approved constraints and gives actionable feedback.
Kubernetes Pod Security Standards at namespace scope using enforce, audit and/or warn modes.
Narrow scope, owner, rationale, expiry and compensating controls where needed.
Actionable policy feedback showing the failed rule, required remediation and legitimate exception path.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.