Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 112/ 160
06. Security, RBAC & Governance

Restricting Registries & Enforcing Image Digests

Allow only trusted registries and pin workloads to immutable image digests.

IntermediateRegistry Allowlist · Digests · Immutability3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Restricting registries chooses the approved suppliers, and pinning a digest records the serial number of the exact box received. The simple Kubernetes rule is: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Think of it like…

Restricting registries chooses the approved suppliers, and pinning a digest records the serial number of the exact box received.

Where you’ve seen it

During an access review, the security engineer runs kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256. Expected evidence: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag. If the run instead shows this symptom, stop and restore the last known state: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.

Words you’ll hear

Registry Allowlist
For this lesson, Registry Allowlist is the controlling idea: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.
Digests
Digests is the checkpoint; run kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 and inspect the owner chain. Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.
Immutability
Immutability is the outcome to preserve; the cost is explicit: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.
Verification evidence
The evidence command is kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256. It connects the declaration to this behavior: Allow only trusted registries and pin workloads to immutable image digests.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Registry Allowlist reaches the intended state

Allow only trusted registries and pin workloads to immutable image digests. Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

The concrete checkpoint is kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256; compare the Registry Allowlist owner, Digests state, and Immutability outcome instead of treating YAML acceptance as proof.

Verify Digests, not only object creation

Run kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 after the change and correlate the result with Events and the owning object. Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Key takeaway: Registry Allowlist is implemented only when this invariant remains observable: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Digests: failure boundary and production cost

Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls. The prerequisite contract is concrete: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy. A safe design limits blast radius, records the last good configuration, and uses kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 as a deterministic rollback checkpoint.

Recover from Digests drift

Capture the current state with kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.

Key takeaway: Accept the trade-off consciously: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.

How it works, step by step

Step 1 of 4
Identity owner

1. Model the trust boundary

Name the identity, action, resource, and trust boundary before choosing a control: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Registry Allowlist contract → owned state
Key numbers at this step
Goal
Allow only trusted registries and pin workloads to immutable image digests.
Owner
Registry Allowlist

When to use it & trade-offs

What it is

Allow only trusted registries and pin workloads to immutable image digests. Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Why it matters: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls. The invariant at risk is specific: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag. The quickest fact check before changing the design is kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256.

When to reach for it

  • Use Registry Allowlist to enforce this invariant: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.
  • Use Digests evidence from kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 in reviews and incident timelines. Allow only trusted registries and pin workloads to immutable image digests.
  • Choose the hosted security service route only when this cost is justified by governance or scale: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.

When to avoid or be careful

  • Avoid assuming Registry Allowlist is complete after YAML submission; the required behavior is concrete: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 first: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.

Native, manual, and managed paths for Registry Allowlist

Admission and least privilege
Best for: Allow only trusted registries and pin workloads to immutable image digests. A concrete incident check is kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256.

Strengths: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Watch out: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy. Recovery must also recognize this signal: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.

Runtime-only detection
Best for: Quickly testing the Digests assumption with kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256; the expected invariant is: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Strengths: kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Registry Allowlist, it does not make this symptom self-documenting: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.

Hosted security service
Best for: Teams that need Immutability integrated with guardrails; the evidence path is kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.

Watch out: The added platform ownership buys value at this cost: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.
  • Trace Registry Allowlist to Immutability through Digests; the invariant is: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.
  • Recognize the symptom: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.
  • Justify the cost: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.
  • Verify with kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 instead of only inspecting YAML.

Benchmarks & rules of thumb

2 -
independent controls: trusted registry and immutable digest
64 -
hexadecimal characters are normally in a SHA-256 digest after sha256 colon
1 -
manifest digest is selected for a specific platform variant by runtime resolution

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Registry Allowlist owner contract: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag.
  • Ignoring this telltale condition leads to unrelated changes: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls.
  • Repeating kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256 without an owner for remediation wastes retry cost. Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag?
  • Which owner object, logs, and Events would you inspect for this symptom-Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls-?
  • At what threshold would this cost become unacceptable: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy?
Interview tip: Interview sequence: state the invariant, run kubectl get clusterpolicy; crictl inspecti registry.example/api:v3 | grep -i sha256, name the failure, then justify the cost. Invariant: Registry allowlists block images outside approved hosts and digest enforcement pins the exact manifest immutable content instead of a moving tag. Failure: Tag filtering alone still permits a compromised registry path or reused tag, while a digest copied without the required platform architecture can cause image-not-found pulls. Cost: Digests make rollbacks and evidence reproducible, but they expose noisy version updates and still rely on a trusted registry and signature policy.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Restricting Registries & Enforcing Image Digests with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Image Supply Chain Security: Admission Verification with Cosign & Kyverno
Next topic
Encrypting Secrets at Rest in etcd with KMS Providers