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 111/ 160
06. Security, RBAC & Governance

Image Supply Chain Security: Admission Verification with Cosign & Kyverno

Admit only signed images by verifying Cosign signatures at admission time.

AdvancedCosign · Admission · Signatures3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Cosign is a seal tied to the exact crate digest, while Kyverno checks that the maker and seal match the approved maker list at the door. The simple Kubernetes rule is: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Think of it like…

Cosign is a seal tied to the exact crate digest, while Kyverno checks that the maker and seal match the approved maker list at the door.

Where you’ve seen it

During an access review, the security engineer runs kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123. Expected evidence: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact. If the run instead shows this symptom, stop and restore the last known state: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.

Words you’ll hear

Cosign
For this lesson, Cosign is the controlling idea: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.
Admission
Admission is the checkpoint; run kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 and inspect the owner chain. Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.
Signatures
Signatures is the outcome to preserve; the cost is explicit: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.
Verification evidence
The evidence command is kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123. It connects the declaration to this behavior: Admit only signed images by verifying Cosign signatures at admission time.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Cosign reaches the intended state

Admit only signed images by verifying Cosign signatures at admission time. Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

The concrete checkpoint is kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123; compare the Cosign owner, Admission state, and Signatures outcome instead of treating YAML acceptance as proof.

Verify Admission, not only object creation

Run kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 after the change and correlate the result with Events and the owning object. Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Key takeaway: Cosign is implemented only when this invariant remains observable: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Admission: failure boundary and production cost

Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer. The prerequisite contract is concrete: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed. A safe design limits blast radius, records the last good configuration, and uses kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 as a deterministic rollback checkpoint.

Recover from Admission drift

Capture the current state with kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.

Key takeaway: Accept the trade-off consciously: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.

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: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Cosign contract → owned state
Key numbers at this step
Goal
Admit only signed images by verifying Cosign signatures at admission time.
Owner
Cosign

When to use it & trade-offs

What it is

Admit only signed images by verifying Cosign signatures at admission time. Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Why it matters: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer. The invariant at risk is specific: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact. The quickest fact check before changing the design is kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123.

When to reach for it

  • Use Cosign to enforce this invariant: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.
  • Use Admission evidence from kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 in reviews and incident timelines. Admit only signed images by verifying Cosign signatures at admission time.
  • Choose the hosted security service route only when this cost is justified by governance or scale: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.

When to avoid or be careful

  • Avoid assuming Cosign is complete after YAML submission; the required behavior is concrete: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 first: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.

Native, manual, and managed paths for Cosign

Admission and least privilege
Best for: Admit only signed images by verifying Cosign signatures at admission time. A concrete incident check is kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123.

Strengths: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Watch out: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed. Recovery must also recognize this signal: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.

Runtime-only detection
Best for: Quickly testing the Admission assumption with kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123; the expected invariant is: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Strengths: kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Cosign, it does not make this symptom self-documenting: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.

Hosted security service
Best for: Teams that need Signatures integrated with guardrails; the evidence path is kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.

Watch out: The added platform ownership buys value at this cost: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.
  • Trace Cosign to Signatures through Admission; the invariant is: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.
  • Recognize the symptom: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.
  • Justify the cost: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.
  • Verify with kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 instead of only inspecting YAML.

Benchmarks & rules of thumb

2 -
immutable inputs: image digest and certificate or public key identity
1 -
attestation or signature policy should bind an issuer and subject
0 -
integrity guarantee from signing a repository tag without digest semantics

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Cosign owner contract: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact.
  • Ignoring this telltale condition leads to unrelated changes: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer.
  • Repeating kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123 without an owner for remediation wastes retry cost. Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact?
  • Which owner object, logs, and Events would you inspect for this symptom-Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer-?
  • At what threshold would this cost become unacceptable: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed?
Interview tip: Interview sequence: state the invariant, run kubectl get clusterpolicy verify-images; cosign verify --certificate-identity=release@acme.example registry.example/api@sha256:abc123, name the failure, then justify the cost. Invariant: Cosign signs image digests, and Kyverno admission can verify signatures, attestations, issuers, subjects, and transparency evidence before pulling a trusted artifact. Failure: Verifying only a mutable tag, accepting any issuer, omitting digest pinning, or allowing the first mutable admission cache can trust the wrong producer. Cost: Signature verification raises supply-chain confidence, but keyless identity, Rekor availability, offline operation, and emergency override paths must be designed.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Image Supply Chain Security: Admission Verification with Cosign & Kyverno with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Open Policy Agent (OPA) & Gatekeeper Constraints
Next topic
Restricting Registries & Enforcing Image Digests