Skip to content

Artifact Repository and Image Security: KCSA practice questions

Artifact repository and image security is about trusting the code a cluster runs. An image is built, pushed to a registry, pulled onto a node and started by the container runtime, and an attacker who can tamper with any of those steps can run code inside your workloads.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Artifact Repository and Image Security covers in KCSA

Artifact repository and image security is about trusting the code a cluster runs. An image is built, pushed to a registry, pulled onto a node and started by the container runtime, and an attacker who can tamper with any of those steps can run code inside your workloads. The defenses fall into three groups: keep the image itself small and patched, make the reference to it immutable, and verify where it came from before it is admitted.

Image content comes first. The Kubernetes security checklist asks you to minimize unnecessary content in container images, to configure images to run as an unprivileged user, and to scan images regularly both when they are created and while they are deployed, patching known vulnerable software. A multistage build serves the first goal: compilers, package managers and test tooling stay in an earlier build stage, and only the runtime artifacts are copied into the final stage, so there is less software for a scanner to flag and for an attacker to use. When a scanner reports a vulnerable image, the fix is to rebuild from a patched base and redeploy, not to retag the same content.

References matter as much as content. Kubernetes documentation states that tags can be moved to point to different images while digests are fixed, because a digest is a hash of the image content. A reference such as image@sha256:... pins the exact bytes you run; when an image reference carries both a tag and a digest, only the digest is used for pulling. The same documentation advises against the latest tag in production, because it is harder to track which version is running and harder to roll back. If no tag is given at all, Kubernetes assumes latest.

The pull policy controls when the kubelet goes back to the registry. With IfNotPresent the image is pulled only if it is not already on the node, with Always the runtime resolves the tag to a digest on every container start, and with Never the kubelet does not try to fetch the image, so startup fails if it is not present locally. Private registries are reached with imagePullSecrets, which must be Secrets of type kubernetes.io/dockercfg or kubernetes.io/dockerconfigjson in the same namespace as the Pod. In multi-tenant clusters the AlwaysPullImages admission controller matters: without it, a Pod can start from an image already cached on the node even if its owner holds no credentials for that registry.

Provenance closes the loop. Sigstore signs artifacts with cosign, issues short-lived certificates bound to an OIDC identity through Fulcio, and records the signature in the Rekor transparency log, so a successful verification shows that the image is unaltered and came from the expected identity. Kubernetes signs its own release images this way. To make verification mandatory, the security checklist asks that image provenance is validated at deploy time through admission control, for example with the sigstore policy-controller or a policy engine; a registry list alone does not prove who built the image.

Key points

  • A tag is a movable pointer; a sha256 digest is a content hash and cannot change.
  • imagePullPolicy: Never fails container startup when the image is not already on the node.
  • imagePullSecrets must live in the Pod's namespace and be of type kubernetes.io/dockercfg or kubernetes.io/dockerconfigjson.
  • AlwaysPullImages forces a pull on every Pod start so cached images cannot be used without registry credentials.
  • Sigstore keyless signing ties a signature to an OIDC identity and logs it in the Rekor transparency log.

Three sample questions

14 KCSA questions on Artifact Repository and Image Security, 14 with explanations. How practice works

Question 1

What is the primary purpose of signing container images in a cloud-native environment?
  1. A.To reduce the image size for deployment
  2. B.To verify the image's integrity and authenticity
  3. C.To include metadata for deployment automation
  4. D.To enforce runtime security policies
  5. E.To speed up image pulling during deployment

Correct answer: B

The primary purpose of image signing is to ensure that a container image originates from a trusted source and has not been tampered with. This process involves cryptographically signing the image, allowing users to verify its integrity and authenticity before use. Incorrect options such as reducing image size or speeding up deployment do not relate to the security function of signing. Similarly, metadata inclusion and runtime policy enforcement are separate mechanisms unrelated to image signing.

Sources: Docker Content Trust Documentation, CNCF Cloud Native Security Whitepaper

Question 2

How do multistage builds in Docker reduce image size?
  1. A.By running multiple containers within a single image
  2. B.By creating images compatible with multiple architectures
  3. C.By separating build-time dependencies from runtime components in different stages
  4. D.By enabling parallel builds across multiple stages
  5. E.By deploying to multiple environments simultaneously

Correct answer: C

Multistage builds in Docker allow developers to separate build-time dependencies (e.g., compilers, libraries) from runtime components by using multiple FROM instructions in a single Dockerfile. This ensures that only the necessary artifacts (e.g., binaries) are included in the final image, significantly reducing its size and improving security. While multistage builds can simplify workflows, they do not inherently enable parallel builds or support multi-environment deployments.

Sources: Docker Documentation: Multi-Stage Builds, Earthly Blog: Understanding Docker Multistage Builds

Question 3

What components are necessary to verify the integrity and authenticity of a container image?
  1. A.A checksum and the image manifest
  2. B.A digital signature, public key, and verification tool
  3. C.The Dockerfile used to build the image
  4. D.Access to the container registry logs
  5. E.The image's pull secret

Correct answer: B

To verify the integrity and authenticity of a container image, you need a digital signature, a public key to verify the signature, and a verification tool. This ensures that the image has not been tampered with and comes from a trusted source.

Sources: Docker Security Documentation, Container Image Security Best Practices

Practice this topic

Focus mode keeps every question on Artifact Repository and Image Security until you leave it. 10 free guest answers, then a free account; no credit card.

Or open KCSA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

Does using a private registry prove that an image is trustworthy?

No. A private registry with imagePullSecrets controls who can pull, but it says nothing about who built the image or whether it changed after the build. Integrity and provenance come from signatures verified at admission time, and immutability comes from pinning the digest.