SaveMyCert
Log in
5 of 5 free questions left today·for 10 a day
Platform Security

KCSA Supply Chain Security, Image Registries and Admission Control

18 min readKCSA · Platform SecurityUpdated

Platform supply chain security in Kubernetes is the set of controls that prove what is in an image, where and how it was built, and who signed it, then enforce those facts when Pods are admitted. This lesson covers SBOMs and their SPDX and CycloneDX formats, SLSA build provenance, Sigstore keyless signing with cosign, Fulcio and Rekor, verifying signatures at admission and pinning Pods to digests, private registries with imagePullSecrets, ServiceAccounts and kubelet credential providers, registry hardening, the AlwaysPullImages plugin, and how admission control works: mutating and validating phases, webhook failure policies and timeouts, ValidatingAdmissionPolicy, OPA Gatekeeper and Kyverno.

What you’ll learn
  • Distinguish an SBOM, build provenance, an image signature and a vulnerability scan report by the question each one answers
  • Explain Sigstore keyless signing with cosign, Fulcio and Rekor, and why expired certificates still verify
  • Enforce signatures and provenance at admission time and explain why admitted Pods are pinned to the verified digest
  • Configure private registry access with imagePullSecrets, ServiceAccounts and kubelet credential providers, and harden the registry with least-privilege pull accounts, tag immutability and scan gates
  • Explain the AlwaysPullImages plugin and why registry allowlists belong in admission policy rather than NetworkPolicy
  • Describe the admission order, what admission does not cover, and how failurePolicy, timeoutSeconds, namespace exclusions and reinvocationPolicy behave
  • Compare ValidatingAdmissionPolicy, OPA Gatekeeper and Kyverno, including validationActions and Gatekeeper's ConstraintTemplate and Constraint objects

What supply chain security means for Kubernetes workloads

Supply chain security is making sure that the images a cluster runs contain what you think they contain, came from the build system and source you trust, and have not been changed since. Kubernetes itself will run any image a Pod names, so the evidence has to be produced during the build, stored with the image, and then checked before the Pod is admitted.

Four kinds of evidence answer four different questions, and telling them apart is the core of this topic:

EvidenceQuestion it answersTypical tools and formats
Software bill of materials (SBOM)What is inside the image: which packages, libraries and versions?SPDX, CycloneDX; generated by tools such as Syft or Trivy
Build provenanceHow, where and from what source was the image built?SLSA provenance, carried as an in-toto attestation
SignatureWhich key or identity signed this exact image, and is it unchanged?Sigstore cosign (key-based or keyless)
Vulnerability scan reportWhich known CVEs did a scanner find, at the moment it ran?Trivy, Grype, registry scanners

None of these replaces another. A signed image can still be full of vulnerable packages; an SBOM says nothing about who built the image; a scan report goes stale the day a new CVE is published. The pieces also combine: an SBOM or provenance document is usually signed and attached to the image as an attestation, so a verifier can trust it as much as the image signature itself. Image scanning basics, digest references and what a plain signature proves are introduced in the KCSA lesson on image and application code security; this lesson focuses on how the evidence is produced and enforced at the platform level.

SBOMs: what they list and how they help after a new CVE

An SBOM is a machine-readable inventory of the components that make up a piece of software: operating-system packages, language libraries, their versions and often their suppliers and licences. It does not record how the software was built, whether it is vulnerable today, or who published it.

The two standard SBOM formats are:

  • SPDX — a Linux Foundation standard, also published as ISO/IEC 5962. The Kubernetes project publishes SBOMs for its own release artifacts in SPDX.
  • CycloneDX — an OWASP standard, widely used by application security tools.

Other supply chain standards sit beside SBOMs and do different jobs: SLSA is a framework of supply chain security levels with its own provenance format; in-toto is a framework for signed statements (attestations) about supply chain steps, which can carry an SBOM as a payload; OCI defines how images and other artifacts are packaged and stored in registries, which is where SBOMs and signatures are often kept next to the image.

The practical payoff comes when a new vulnerability is disclosed. If an SBOM was generated for every image at build time and stored alongside it, the security team can search the SBOMs for the affected library and version and list every affected image in minutes, without pulling and unpacking hundreds of images. A scan report kept from build day cannot do this, because it was produced before the CVE existed. Some vendors also publish VEX (Vulnerability Exploitability eXchange) statements next to an SBOM, saying whether a listed component's CVE actually affects the product, so teams can triage findings faster.

Build provenance, SLSA and why a shared signing key is not enough

Build provenance is verifiable metadata about how an artifact was produced: the build platform (builder identity), the source repository and revision, and the build parameters and inputs. SLSA (Supply-chain Levels for Software Artifacts) defines a provenance format and a set of levels for how trustworthy the build process is; the provenance is normally expressed as an in-toto attestation and signed by the build platform.

Provenance answers a question that signatures alone cannot. A signature proves which key signed an image. If several people hold that key, for example developers who can sign images they built on their laptops, then a check that only asks "is it signed with our key?" accepts those laptop builds too. Provenance generated and signed by the CI build platform records which builder ran and which repository it built from, so an admission policy can require that the builder is the company's CI system and the source is its main repository. A laptop build cannot produce that attestation, even if it carries a valid team signature.

RequirementEvidence that satisfies itWhy the others fall short
Know which libraries an image containsSBOMProvenance and signatures do not list contents
Only run images built by our CI from our repositorySigned provenance with builder and source checkedA shared key signs any build; an SBOM or digest says nothing about where the build ran
Know the image was not altered after publishingSignature over the image digestAn SBOM describes contents but does not prove integrity unless it is itself signed

Sigstore keyless signing: cosign, Fulcio and Rekor

Sigstore keyless signing replaces a long-lived private key with a short-lived certificate tied to the signer's identity. It is the default way cosign signs images today, and it has three parts:

  • cosign — the client. It obtains an OIDC identity token (from a CI system's workload identity or a user login), generates an ephemeral key pair, signs the image digest and pushes the signature to the OCI registry next to the image.
  • Fulcio — Sigstore's certificate authority. It checks the OIDC token and issues a short-lived signing certificate (valid for minutes) bound to that identity and issuer.
  • Rekor — Sigstore's transparency log. It records each signing event in a tamper-evident, publicly auditable log with a trusted timestamp.

The short certificate lifetime is deliberate: there is no stored key to steal, and the ephemeral key is useless almost at once. Verification months later still works because the verifier does not need a currently valid certificate. It checks that the signature, the certificate and the Rekor entry agree, and that Rekor's trusted timestamp (or one from a timestamp authority) shows the signing happened inside the certificate's validity window. Nothing is renewed when an image is pulled, and a registry's push time is never trusted evidence, since anyone with push rights can re-push. A verifier then checks the identity in the certificate (for example, the CI workflow that signed) and the OIDC issuer, rather than a public key.

Enforcing signatures and attestations at admission time

Signing creates evidence; only an admission controller that checks it stops unsigned or untrusted images from running. Without one, a cluster runs an unsigned image from a public registry without complaint, no matter how carefully the CI pipeline signs its own builds. Adding more evidence in the pipeline does not help when nothing in the cluster checks for it.

Common enforcement points:

  • Kyverno verifyImages rules — verify cosign signatures (key-based or keyless identity) and attestations such as SLSA provenance or SBOMs, with conditions on their fields.
  • Sigstore policy-controller — an admission webhook that enforces ClusterImagePolicy rules for signatures and attestations.
  • OPA Gatekeeper with an external data provider (for example Ratify) — Gatekeeper calls out to a verifier during admission.

Pin the admitted Pod to the verified digest. Two facts make this necessary. Tags are mutable pointers in a registry, and admission checks a Pod once, when it is created. If the admitted Pod still references a tag, the kubelet resolves that tag again on every pull, so if someone re-pushes the tag with an unsigned image, Pods rescheduled onto new nodes run it without any check. Signature-verifying policies therefore resolve the tag and mutate the Pod spec to the digest they verified (Kyverno's verifyImages does this by default through mutateDigest; the policy-controller also resolves tags to digests). The underlying rule: a tag is a movable pointer and a digest is not, so any control that re-resolves the tag later, at pull time, cannot guarantee the image that was verified at admission.

Image repositories: private registries and pull credentials

A private image registry stores an organisation's images behind authentication, and Kubernetes gives the kubelet the credentials to pull from it through imagePullSecrets, ServiceAccounts or a kubelet credential provider. The key point is that the kubelet pulls images on the node before any container starts, so credentials must reach the kubelet. Container environment variables, mounted ConfigMaps and annotations never do.

  • imagePullSecrets — a Pod's spec.imagePullSecrets lists Secrets of type kubernetes.io/dockerconfigjson (or the older kubernetes.io/dockercfg). The kubelet uses them for that Pod's pulls. Like every Secret reference from a Pod, the name is resolved in the Pod's own namespace; there is no namespace-qualified form, so a Secret with the same name in another namespace is invisible and the pull goes out without credentials, typically ending in ImagePullBackOff with an authentication error.
  • ServiceAccount imagePullSecrets — a ServiceAccount also has an imagePullSecrets field. When a Pod using it is created without its own imagePullSecrets, the ServiceAccount admission controller copies them into the Pod. Setting it on a namespace's default ServiceAccount gives the credentials to every new Pod in that namespace that runs as the default ServiceAccount and sets no imagePullSecrets of its own, without editing manifests.
  • Kubelet image credential providers — the kubelet can run an exec plugin (configured with --image-credential-provider-config and --image-credential-provider-bin-dir, GA since v1.26) that fetches short-lived registry credentials on demand when it pulls from matching registries. Cloud registries whose tokens expire after hours use this, so nothing long-lived is stored in the cluster and nobody has to rotate Secrets.
apiVersion: v1
kind: ServiceAccount
metadata:
  name: default
  namespace: payments
imagePullSecrets:
- name: regcred   # must exist in namespace payments

Hardening the registry itself

Registry-side controls limit what a stolen credential can do and what images can ever reach a node. Registries such as Harbor, and the cloud providers' registries, offer several settings that are easy to confuse:

Registry settingWhat it doesWhat it does not do
Tag immutability rulesRejects a push that would repoint an existing tag (such as payments:2.4.1) at different contentDoes not restrict who can read images or block vulnerable ones
Retention rulesDeletes old images to save spaceDoes not protect tags from being overwritten
Replication rulesCopies images to another registry or regionDoes not protect or verify content
Pull-through (proxy) cacheMirrors an upstream registry locallyDoes not make tags immutable or vet the upstream images
Scan and block on severityScans images and refuses to serve those with findings at or above a chosen severityDoes not prove who built the image
Signature (content trust) enforcementRefuses unsigned imagesA signed image can still carry critical CVEs

Least privilege for pull credentials. Nodes only need to read images, so the credential they hold should be a pull-only robot or service account limited to the projects their workloads actually use. A push-capable credential lets an attacker who steals it alter images; a pull-only credential covering the whole registry still lets them read every other team's images. Tag immutability protects everyone who still deploys by tag, while digests remain the strongest pin in a Pod spec.

Cached images, AlwaysPullImages and restricting registries

A private image that is already cached on a node is not protected by registry credentials, and the AlwaysPullImages admission plugin closes that gap by forcing every new Pod to pull. With imagePullPolicy: IfNotPresent (or Never), the kubelet starts a container from a cached image without contacting the registry, so credentials are never checked. In a multi-tenant cluster, tenant B can therefore run a private image that tenant A's Pod pulled onto the same node, without having any credentials for it.

AlwaysPullImages is a mutating admission plugin on the kube-apiserver that sets imagePullPolicy: Always on every new Pod. Each container start then goes to the registry with that Pod's own credentials, and a Pod without valid credentials fails to pull. It does not verify signatures, block particular tags or pin digests, and it does not supply or refresh credentials. Newer kubelet releases also add a node-side option that re-verifies credentials before reusing a cached private image; AlwaysPullImages remains the long-documented control.

Restrict image sources at admission, not with NetworkPolicy. Images are pulled by the kubelet and container runtime over the node's network, outside the Pod's network namespace. A NetworkPolicy that blocks Pod egress to every registry but the approved one has no effect on which images can be pulled. The rule "Pods may only use images from registry.example.com/" is a check on the Pod spec, so it belongs in an admission policy: a ValidatingAdmissionPolicy with a CEL expression over every container's image, or a Kyverno or Gatekeeper rule. Pod Security Admission cannot do it, because the Pod Security Standards have no registry check. If needed, firewall the nodes themselves as an extra layer.

How admission control works: mutating first, then validating

Admission control is the stage of the kube-apiserver that can change or reject a request after authentication and authorization, and before the object is stored in etcd. It runs in a fixed order:

  1. Mutating admission — built-in mutating plugins (such as AlwaysPullImages or the ServiceAccount plugin) and MutatingAdmissionWebhooks may change the object.
  2. Object schema validation — the API server checks the result is a valid object.
  3. Validating admission — built-in validating plugins, ValidatingAdmissionPolicies and ValidatingAdmissionWebhooks may only accept or reject.
  4. Persistence — only then is the object written to etcd. A rejected request is never stored.

Because validation comes last, validators judge exactly what will be stored, including every mutation. If a mutating webhook injects a sidecar without CPU and memory limits, and a validating webhook requires limits on every container, the Pod is rejected even when the developer's own container is compliant. The fix is to make the injected container compliant, not to expect the validator to ignore mutations.

What admission does not do. Admission intercepts requests that create, update, delete or connect to objects. It does not:

  • re-check objects that existed before the policy was added (those keep running unchanged);
  • intercept reads such as get, list and watch;
  • see node-local events such as the kubelet restarting a crashed container, which makes no new API request.

Pods created by controllers (a ReplicaSet scaling up, a Job starting) do go through admission, because controllers create them through the API server. To find violations among existing objects, use the policy engine's audit or background scan: Gatekeeper audit periodically evaluates existing resources against every Constraint and lists violations in the Constraint's status, and Kyverno background scans write policy reports. The kube-apiserver audit log is different: it records requests as they happen and judges nothing.

Admission webhooks: failure policy, timeouts and reinvocation

An admission webhook is an external HTTPS service the API server calls during admission, and its configuration decides what happens when the service is slow, down or runs before another mutation. The settings that matter for security and availability:

SettingValuesEffect
failurePolicyFail (default in admissionregistration.k8s.io/v1) or IgnoreWhen the call errors or times out, Fail rejects the matching request (fail-closed); Ignore admits it as if allowed (fail-open)
timeoutSeconds1–30, default 10A call that takes longer is treated as a failure, and the failure policy decides the outcome at once; there is no retry and late answers are discarded
namespaceSelector / objectSelectorLabel selectorsLimit which requests are sent to the webhook
reinvocationPolicy (mutating only)Never (default) or IfNeededIfNeeded calls the webhook again if a later admission plugin changes the object after its first call
matchPolicyEquivalent (default) or ExactWhether requests for other API versions of a matched resource are also sent

Avoid locking the cluster out. A webhook with failurePolicy: Fail that matches Pod creation in every namespace becomes part of the cluster's availability: if all its Pods crash, no Pods can be created anywhere, including the webhook's own replacements. The Kubernetes good-practice guidance is to keep Fail for workloads and exclude the webhook's own namespace and kube-system with a namespaceSelector, so the webhook and critical components can always recover. The general principle: a lockout is a scoping problem, so the fix is to narrow what the webhook intercepts, not to weaken how it fails. Changing the failure mode trades the lockout for unenforced policy, and changing the timeout does not change what happens when the webhook is unreachable.

Mutation order. Mutating webhooks run one after another. If webhook A sets a seccomp profile on every container and webhook B later injects a sidecar, A never saw the sidecar. Setting reinvocationPolicy: IfNeeded on A makes the API server call it again after B's change, so the sidecar is fixed too. In general, validating admission sees the final object but can only accept or reject it; correcting an object is a mutating job, so a mutation that must cover changes made by later mutators needs reinvocation.

ValidatingAdmissionPolicy, OPA Gatekeeper and Kyverno compared

Kubernetes offers a built-in policy mechanism, ValidatingAdmissionPolicy, while OPA Gatekeeper and Kyverno are CNCF policy engines that run as admission webhooks with richer features.

ValidatingAdmissionPolicy (GA in Kubernetes v1.30) holds Common Expression Language (CEL) validation rules that the kube-apiserver evaluates in-process, so there is no webhook server to deploy, no network hop and no webhook availability risk. A ValidatingAdmissionPolicyBinding attaches the policy to resources and sets validationActions:

  • Deny — reject violating requests.
  • Warn — return a warning to the client (kubectl prints it) without rejecting.
  • Audit — add the violation to the API server's audit events without rejecting.

Deny and Warn cannot be combined (the failure would be reported twice). Warn plus Audit is the usual way to roll out a rule: developers see the violation, the security team has a record, nothing is blocked; later the binding switches to Deny. Kubernetes is also adding MutatingAdmissionPolicy, a CEL-based in-process counterpart for mutation, in newer releases.

MechanismPolicy languageValidateMutateGenerate resourcesVerify image signatures
ValidatingAdmissionPolicyCEL, in the API serverYesNoNoNo
OPA GatekeeperRego (CEL is a newer option)YesYes, through separate mutation resources (Assign, AssignMetadata)NoOnly through an external data provider
KyvernoKubernetes YAML resources (plus CEL)YesYesYes (for example a default NetworkPolicy per new namespace)Yes, verifyImages
Pod Security AdmissionNone: fixed Pod Security Standards levelsEnforces on Pods only (warns and audits on workload templates too)NoNoNo

Gatekeeper's two objects. A ConstraintTemplate contains the Rego logic and a parameter schema and creates a new constraint kind (for example K8sRequiredLabels); it enforces nothing on its own. A Constraint of that kind chooses which resources it matches, supplies the parameters (such as the list of required labels) and sets the enforcement action. Kyverno's equivalents are ClusterPolicy and Policy resources. Gatekeeper's sync configuration only copies existing objects into its cache so policies can reference them (for example, uniqueness checks); it reports no violations, which is the job of audit.

Tip. KCSA questions on this topic are mostly short definitions and scenarios from a platform security engineer's point of view. Expect to identify what each kind of supply chain evidence contains, name the standard SBOM formats, and explain the roles of the Sigstore components in keyless signing. Scenario items describe a gap somewhere between build, registry, admission and the node's image cache, and ask which control closes it. Admission questions cover the order of the admission phases, what admission does and does not re-check, how webhook failure and timeout settings behave, how to avoid locking a cluster out, and which policy mechanism fits a stated need. Distractors are real Kubernetes or registry features that act at the wrong layer, on the wrong object or at the wrong time.

Key takeaways
  • An SBOM lists components and versions (SPDX or CycloneDX); provenance records builder, source and build inputs; a signature proves which key or identity signed the image; a scan report lists CVEs known when it ran.
  • Stored SBOMs let a team find every image affected by a new CVE without pulling images; an old scan report cannot list a CVE published after it.
  • When a signing key is shared, only signed provenance from the CI builder proves an image came from CI and the expected repository.
  • In keyless signing, Fulcio issues a short-lived certificate from an OIDC identity and Rekor logs the event with a trusted timestamp, which is why signatures verify after the certificate expires.
  • Signatures only matter if an admission policy (Kyverno verifyImages, Sigstore policy-controller, Gatekeeper with external data) checks them, and that policy should rewrite the Pod to the verified digest because tags are mutable.
  • imagePullSecrets are resolved in the Pod's namespace; a ServiceAccount's imagePullSecrets are copied into its Pods; kubelet credential provider plugins fetch short-lived registry tokens on demand.
  • Nodes should pull with a pull-only account limited to the projects they need; tag immutability stops tags being overwritten, and scan-and-block stops vulnerable images being served.
  • AlwaysPullImages forces imagePullPolicy: Always so cached private images cannot be reused without credentials; NetworkPolicy cannot restrict registries because the node, not the Pod, pulls.
  • Mutating admission runs before validating admission, so validators see injected changes; admission never re-checks existing objects, reads or node-local restarts, so use Gatekeeper audit or Kyverno background scans.
  • failurePolicy Fail is fail-closed and Ignore fail-open, a timeout counts as a failure, and fail-closed webhooks should exclude their own namespace and kube-system to avoid lockout.

Check yourself: 3 questions on this topic

Exam-style KCSA questions on Supply chain security, image repositories and admission control, answered right here with an explanation after each. Want more? KCSA Platform Security practice questions.

Frequently asked questions

What is the difference between an SBOM and SLSA provenance?

An SBOM (software bill of materials) is an inventory of the packages, libraries and versions inside an image, in a format such as SPDX or CycloneDX. SLSA provenance describes how the image was built: the build platform, the source repository and revision, and the build inputs. An SBOM helps find images affected by a new CVE; provenance proves an image came from the expected build system and source.

How does Sigstore keyless signing work?

In Sigstore keyless signing, cosign gets an OIDC identity token, Fulcio (Sigstore's certificate authority) issues a short-lived certificate bound to that identity, cosign signs the image digest with an ephemeral key, and Rekor (the transparency log) records the signing event with a trusted timestamp. Verifiers check the signer's identity and issuer, and use the Rekor timestamp to confirm the signature was made while the certificate was valid, so it still verifies after the certificate expires.

Why should an admission policy pin Pods to an image digest after verifying a signature?

Image tags are mutable, and admission checks a Pod only once, when it is created. If the admitted Pod keeps a tag, every later pull resolves the tag again, so a re-pushed unsigned image would run on new nodes without any check. Rewriting the Pod to the digest that was verified, as Kyverno verifyImages does by default, guarantees every pull fetches the signed content.

How do Kubernetes Pods get credentials for a private image registry?

The kubelet pulls images before containers start, so credentials must reach the kubelet. A Pod lists Secrets of type kubernetes.io/dockerconfigjson in spec.imagePullSecrets, resolved in the Pod's own namespace; a ServiceAccount's imagePullSecrets are added automatically to Pods that use it; and a kubelet image credential provider plugin can fetch short-lived registry tokens on demand so no static token is stored.

What does the AlwaysPullImages admission controller do?

AlwaysPullImages is a mutating admission plugin on the kube-apiserver that sets imagePullPolicy: Always on every new Pod. Each container start then contacts the registry with that Pod's own credentials, so in a multi-tenant cluster one tenant cannot run another tenant's private image just because it is already cached on the node. It does not verify signatures, block tags or pin digests.

Can a NetworkPolicy stop Pods from using public container registries?

No. Images are pulled by the kubelet and container runtime over the node's network, not from the Pod's network namespace that NetworkPolicy controls. To allow only approved registries, validate the image references in the Pod spec at admission time with a ValidatingAdmissionPolicy, Kyverno or OPA Gatekeeper, and firewall the nodes if an extra network layer is wanted.

What is the difference between failurePolicy Fail and Ignore on an admission webhook?

With failurePolicy: Fail (the default in admissionregistration.k8s.io/v1), a matching request is rejected when the webhook errors or exceeds timeoutSeconds, which keeps the policy enforced but can block the cluster if the webhook is down. With Ignore, the request is admitted as if allowed, which keeps the cluster working but lets requests skip the policy. Fail-closed webhooks should exclude their own namespace and kube-system so they can recover.

How is ValidatingAdmissionPolicy different from OPA Gatekeeper and Kyverno?

ValidatingAdmissionPolicy is built into Kubernetes (GA in v1.30): CEL rules run inside the kube-apiserver, attached by a binding whose validationActions are Deny, Warn or Audit, and it can only validate. OPA Gatekeeper is a webhook-based engine using Rego in ConstraintTemplates applied by Constraints, with separate mutation and an audit of existing resources. Kyverno is a webhook-based engine whose YAML policies can validate, mutate, generate resources and verify image signatures.

Source

This lesson covers the "Platform Security" domain of the official KCSA exam guide. Vendors revise their guides — check the source for the current version.

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?