Courseiva

CCNA Supply Chain Security Questions

14 of 164 questions · Page 3/3 · Supply Chain Security · Answers revealed

151
MCQhard

You want to allow only images from a specific registry (e.g., myregistry.io) to be deployed in your cluster. Which tool or approach is best suited for this requirement?

A.Use OPA/Gatekeeper to create a constraint that checks the image registry
B.Set up a NetworkPolicy to block traffic from other registries
C.Configure an ImagePolicyWebhook
D.Modify the kubelet configuration to only pull from a specific registry
AnswerA

OPA/Gatekeeper operates as a validating admission controller that can evaluate the entire Pod spec before creation. By writing a ConstraintTemplate and a Constraint with Rego logic, you can inspect every container's image field, including initContainers and ephemeral containers, and enforce that the image reference begins with your approved registry host. This is the correct approach because admission control is the only layer that can consistently reject non-compliant workloads across all nodes and namespaces.

Why this answer

OPA/Gatekeeper allows you to define a ConstraintTemplate and a Constraint that validates the image registry in pod specs via a Rego rule. This approach enforces admission control at the API server level, rejecting any pod that references an image from an unauthorized registry before it is persisted in etcd.

Exam trap

A common misconception is that NetworkPolicy can control image sources, but NetworkPolicy operates on network traffic, not on admission of pod specifications.

How to eliminate wrong answers

Option B is wrong because NetworkPolicy controls network traffic between pods and external endpoints at layer 3/4, not image pull sources; it cannot prevent a pod from being created with an image from a disallowed registry. Option C is wrong because ImagePolicyWebhook is a deprecated admission controller that validates image signatures or policies, but it does not natively restrict which registry an image comes from without custom webhook logic, and it is not the recommended or best-suited tool for this specific registry allowlisting requirement. Option D is wrong because modifying the kubelet configuration to restrict image pulls is not a cluster-wide admission control mechanism; it only affects that specific node and can be bypassed by other nodes, and kubelet does not have a native setting to allow only a specific registry.

152
MCQhard

An organization uses a private container registry and wants to ensure that only images built from a specific CI/CD pipeline are deployed. Which combination of measures provides the strongest guarantee?

A.Implement network policies to restrict egress from pods to the registry.
B.Grant registry write access only to the CI system's service account.
C.Use a static analysis tool to check the Dockerfile before building.
D.Use a unique registry path and restrict access via firewall rules.
E.Generate signed attestations with in-toto during the CI pipeline and verify them using an admission webhook like Kyverno.
AnswerE

In-toto attestations are cryptographically signed metadata generated during the CI pipeline that describe the build steps, materials, and results, providing non-repudiation for the image's origin. An admission webhook such as Kyverno can be configured to verify these signatures and attestations at admission time, ensuring that only images produced by the trusted pipeline and with valid provenance are allowed to run. This combination enables robust supply-chain security by tying the runtime state to an auditable, tamper-evident build process.

Why this answer

It implements a complete chain of custody for container images. In-toto generates signed attestations that record every step of the CI/CD pipeline (e.g., source code checkout, build, test), and an admission webhook like Kyverno verifies these attestations before allowing a pod to run. This ensures that only images that passed the exact, attested pipeline are deployed, providing the strongest guarantee against unauthorized or tampered images.

Exam trap

CNCF often tests the distinction between access control measures (network policies, RBAC, firewalls) and cryptographic provenance verification; candidates mistakenly think restricting registry access or network egress is sufficient, but the exam emphasizes that only signed attestations with admission control can guarantee the image was built by the intended pipeline.

How to eliminate wrong answers

Option A is wrong because network policies restrict egress from pods to the registry, which controls runtime access but does not verify the provenance or integrity of the image itself; an attacker could still deploy a malicious image that was built outside the CI/CD pipeline. Option B is wrong because granting registry write access only to the CI system's service account prevents unauthorized pushes but does not prevent the CI system itself from being compromised or building images from untrusted sources; it lacks verification of the build process. Option C is wrong because static analysis of the Dockerfile checks for vulnerabilities or misconfigurations in the build instructions but does not provide any cryptographic proof that the resulting image was actually built from that Dockerfile in the approved pipeline.

Option D is wrong because using a unique registry path and firewall rules restricts network access but does not verify the image's supply chain; an attacker who gains access to the registry path could push arbitrary images.

153
Multi-Selectmedium

Which TWO of the following are valid methods to verify the integrity of a container image before deployment?

Select 2 answers
A.Run a vulnerability scan on the image
B.Use the latest tag to ensure the most recent version
C.Generate an SBOM for the image
D.Use the image digest (SHA256) instead of a tag
E.Verify the image signature using Cosign
AnswersD, E

Using the image digest (e.g., myrepo/app@sha256:…) pins the pull to the exact content-addressed manifest, so any tampering or tag re-pointing produces a different hash and breaks the reference. This defeats tag-mutability and re-tagging attacks, but note the digest is verified against the registry's copy; it does not independently prove the publisher's identity, which is why it is often combined with signatures.

Why this answer

Using the image digest (SHA256) provides a cryptographic hash of the image manifest, ensuring that the exact same image content is pulled every time, regardless of tag changes. This prevents tag mutability attacks where a malicious actor could overwrite a tag with a compromised image. The digest is immutable and uniquely identifies the image content.

Exam trap

The CNCF exam often tests the distinction between integrity verification (cryptographic guarantees) and security scanning or metadata generation, leading candidates to confuse vulnerability scanning or SBOM generation with integrity checks.

154
MCQeasy

Which of the following is a static analysis tool for Kubernetes manifests that can identify security misconfigurations?

A.Clair
B.kubesec
C.OPA/Gatekeeper
D.Notary
AnswerB

kubesec is a purpose-built static analysis tool that evaluates Kubernetes YAML and JSON manifests against a set of security best practices. It inspects fields such as securityContext, privileged modes, capabilities, hostNetwork, and running as root, and produces a security score along with risk ratings. It works directly on manifest files, either via CLI or as a library, making it a true static analyzer for Kubernetes configurations.

Why this answer

kubesec is a static analysis tool that scans Kubernetes manifests (YAML/JSON) and assigns a security score based on misconfigurations such as running containers as root, missing resource limits, or allowing privilege escalation. It operates offline without requiring a running cluster, making it a pure static analysis tool for identifying security issues in manifests before deployment.

Exam trap

The CKS exam often tests the distinction between static analysis (scanning files offline) and dynamic/runtime enforcement (admission controllers), leading candidates to mistakenly choose OPA/Gatekeeper for static scanning when it is actually a runtime policy engine.

How to eliminate wrong answers

Option A is wrong because Clair is a static analysis tool for container images, not Kubernetes manifests; it scans layers for known vulnerabilities (CVEs) in OS packages and libraries. Option C is wrong because OPA/Gatekeeper is a dynamic admission controller that enforces policies at runtime when resources are created or updated, not a static analysis tool for manifests. Option D is wrong because Notary is a tool for signing and verifying container image artifacts to ensure supply chain integrity, not for scanning Kubernetes manifest configurations.

155
MCQhard

You are tasked with creating a Kubernetes admission controller that validates image signatures before allowing pods to run. Which admission controller should you configure?

A.ImagePolicyWebhook
B.MutatingAdmissionWebhook
C.ValidatingAdmissionWebhook
D.NodeRestriction
AnswerA

ImagePolicyWebhook is a built-in admission controller that intercepts Pod creation requests and sends the container image names to an external policy service for a decision. It enforces corporate image security policies, such as requiring images to be signed by a trusted authority or pulled from allowed registries. This is the standard Kubernetes mechanism for integrating external image policy engines, and it is distinct from generic webhooks because it is purpose-built for image validation.

Why this answer

The ImagePolicyWebhook admission controller is specifically designed to validate container image signatures against an external policy engine (e.g., OPA, Sigstore) before a pod is admitted. It intercepts pod creation requests and sends the image metadata to a webhook endpoint, which returns an allow/deny decision based on signature verification. This directly addresses the requirement to enforce image signature validation as part of supply chain security.

Exam trap

The trap here is that candidates often confuse ValidatingAdmissionWebhook (a generic validation tool) with ImagePolicyWebhook (the specific controller for image signature validation), but the CKS exam expects you to know the exact admission controller designed for this supply chain security use case.

How to eliminate wrong answers

Option B (MutatingAdmissionWebhook) is wrong because it modifies objects (e.g., injecting sidecars) but does not inherently validate image signatures; it could be used to call an external service, but the question specifically asks for the admission controller that validates image signatures, and ImagePolicyWebhook is the dedicated controller for that purpose. Option C (ValidatingAdmissionWebhook) is wrong because while it can validate arbitrary policies, it is a generic webhook and not the specific controller designed for image signature validation; the ImagePolicyWebhook is the correct choice as it is purpose-built for this task. Option D (NodeRestriction) is wrong because it limits node kubelet permissions (e.g., preventing modification of pods on other nodes) and has no role in image signature validation.

156
Multi-Selectmedium

Which TWO of the following tools can be used to generate or analyze SBOMs? (Select 2)

Select 2 answers
A.Cosign
B.Kubesec
C.Syft
D.Trivy
E.Checkov
AnswersC, D

Syft generates software bills of materials by scanning container images and filesystems, cataloguing packages and their versions into SPDX or CycloneDX formats. This directly satisfies the stem's requirement to generate SBOMs, complementing analysis tools that consume that output.

Why this answer

Syft is a CLI tool specifically designed to generate Software Bill of Materials (SBOMs) from container images and filesystems. It supports multiple output formats such as CycloneDX and SPDX, making it a direct choice for SBOM generation. Trivy, while primarily a vulnerability scanner, also includes built-in SBOM generation and analysis capabilities, allowing users to output SBOMs in CycloneDX or SPDX formats and to scan existing SBOMs for vulnerabilities.

Exam trap

The CKS exam, part of the CNCF certification, often tests the distinction between tools that perform SBOM generation/analysis versus tools that handle other supply chain security tasks like signing (Cosign) or static configuration scanning (Kubesec, Checkov), leading candidates to confuse vulnerability scanning with SBOM functionality.

157
MCQhard

A security audit reveals that a Deployment uses an image with a mutable tag 'app:latest'. Which change ensures the image is immutable and traceable?

A.Change tag to 'app:stable'
B.Set 'replicas: 1'
C.Use 'image: app@sha256:abc123...'
D.Add 'imagePullPolicy: Always'
AnswerC

Referencing the image with 'image: app@sha256:abc123...' pins the exact immutable manifest by its cryptographic digest. Kubelet fetches that exact digest from the registry, ignoring any tag association, so even if a tag is moved or overwritten, the pods will run the originally audited content. This is the only option that guarantees the image you tested is the image that runs.

Why this answer

Using the image digest (e.g., `image: app@sha256:abc123...`) pins the container image to an immutable, content-addressable identifier. Unlike mutable tags, the digest is a cryptographic hash of the image manifest, ensuring that every pull returns the exact same image, which is critical for traceability and supply chain security.

Exam trap

A common misconception is that using a 'stable' tag provides immutability, but in Kubernetes, any tag can be reassigned. Only the image digest (SHA256) guarantees a specific image version, ensuring traceability and supply chain security.

How to eliminate wrong answers

Option A is wrong because 'app:stable' is still a mutable tag that can be updated to point to a different image, failing to provide immutability. Option B is wrong because setting 'replicas: 1' only controls the number of Pod replicas and has no effect on image immutability or traceability. Option D is wrong because 'imagePullPolicy: Always' forces the kubelet to pull the image every time, but if the tag is mutable, it still allows the underlying image to change, and it does not pin to a specific digest.

158
Drag & Dropmedium

Arrange the steps to secure etcd in a Kubernetes cluster.

Drag or tap steps into the slots.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

Securing etcd involves TLS configuration, restarting, health verification, and network restriction.

159
Multi-Selectmedium

Which TWO of the following are best practices for securing the container supply chain?

Select 2 answers
A.Scan images for vulnerabilities in a CI pipeline before deploying.
B.Use image signing and verification (e.g., with cosign) to ensure image integrity.
C.Embed API keys directly in container images for authentication.
D.Allow all images from any registry without verification to speed up development.
E.Use mutable tags like 'latest' for easier updates.
AnswersA, B

Scanning images for known vulnerabilities in CI, using tools like Trivy or Grype, catches flaws in OS packages and language dependencies before they reach production. Integrate these scans with policy checks that fail the build on critical or high severity CVEs, and also rescan base images on a schedule, since new vulnerabilities are disclosed after the image is built. This is a reactive measure against known issues, distinct from verifying who built the image or that it hasn't been altered.

Why this answer

Scanning images for vulnerabilities in a CI pipeline before deployment is a best practice because it catches known CVEs early, preventing vulnerable images from reaching production. Tools like Trivy, Clair, or Grype integrate into CI/CD to enforce policy gates, ensuring only compliant images proceed.

Exam trap

CNCF often tests the distinction between 'scanning for vulnerabilities' (Option A) and 'signing for integrity' (Option B) as complementary but distinct practices, and the trap is that candidates might think only one is needed or confuse signing with scanning.

160
MCQhard

A developer wants to ensure the container image used in a Deployment is immutable. Which approach BEST guarantees that the exact same image is used every time, preventing tag mutation?

A.Use the image digest like 'myapp@sha256:abc123'
B.Use a tag like 'v1.0-20231001' with a date
C.Use the tag 'v1.0' in the image field
D.Pin the image using a 'latest' tag
AnswerA

A digest is the cryptographic hash of the image manifest, so referencing myapp@sha256:abc123 pins the exact content. Tags are mutable pointers that can be reassigned to different images, whereas the digest cannot change without altering the reference itself.

Why this answer

Using the image digest (e.g., `myapp@sha256:abc123`) guarantees immutability because the digest is a cryptographic hash of the image manifest. Unlike tags, which can be reassigned to different images, the digest uniquely identifies a specific image version, ensuring the exact same image is pulled every time regardless of tag changes.

Exam trap

The CNCF CKS exam often tests the misconception that tags with dates or version numbers are immutable, but the trap is that any tag can be reassigned; only the digest provides a cryptographic guarantee of immutability.

How to eliminate wrong answers

Option B is wrong because a date-based tag like 'v1.0-20231001' is still a mutable tag; it can be overwritten or reassigned to a different image, breaking immutability. Option C is wrong because a semantic version tag like 'v1.0' is mutable and can be updated to point to a different image, violating the requirement for an immutable reference. Option D is wrong because the 'latest' tag is inherently mutable and often updated with new builds, making it the least immutable choice.

161
MCQmedium

A security team wants to ensure that only container images from a trusted registry (mytrustedregistry.io) are deployed in the cluster. They plan to use OPA/Gatekeeper. Which kind of Gatekeeper constraint template and constraint should they create?

A.A constraint that uses a pattern to match the image field against allowed registries
B.A constraint that validates the cluster's registry mirror configuration
C.A constraint that inspects the image field in the Pod's metadata annotations
D.A constraint that checks the imagePullSecrets field in the Pod spec
AnswerA

An admission control policy, such as an OPA/Gatekeeper ConstraintTemplate or a Kyverno ClusterPolicy, can inspect the containers[].image field in the Pod spec and apply a regex or a list of allowed registry prefixes. This directly enforces that every container, including init containers, only references images from trusted registries at admission time. It is the standard, spec-accurate way to restrict image provenance because the image is a first-class field in the container definition.

Why this answer

OPA/Gatekeeper enforces policies via constraint templates that define Rego rules. To restrict container images to a trusted registry, you create a constraint template that inspects the `spec.containers[*].image` field in the Pod spec and uses a pattern (e.g., regex or prefix match) to ensure the image string starts with `mytrustedregistry.io/`. The constraint then applies this template to the cluster, rejecting any Pod that references an image from an untrusted registry.

Exam trap

The CKS exam often tests the misconception that image validation is done via annotations or `imagePullSecrets`, but the actual image source is always in the `spec.containers[*].image` field, and Gatekeeper policies must target that field directly.

How to eliminate wrong answers

Option B is wrong because validating the cluster's registry mirror configuration does not enforce which images are actually used in Pods; it only checks the mirror setup, not the image source. Option C is wrong because the image field is in the Pod spec (`spec.containers[*].image`), not in the Pod's metadata annotations; inspecting annotations would miss the actual image reference. Option D is wrong because `imagePullSecrets` only specifies credentials for pulling images, not the registry source; an attacker could use a secret to pull from an untrusted registry, so checking this field does not prevent deployment of images from unauthorized registries.

162
MCQhard

A Kubernetes cluster enforces image signature verification using the Cosign admission controller. A developer attempts to deploy a pod using an image that was signed with a key that is not in the trusted public key list. The pod is rejected. Which component is responsible for this rejection?

A.The Kubernetes API server's admission chain, specifically the Cosign admission webhook.
B.The Kubernetes scheduler, which filters nodes based on image signature policies.
C.The container runtime interface (CRI) on the node, such as containerd or CRI-O.
D.The kubelet on the node where the pod is scheduled.
AnswerA

Admission webhooks intercept API requests before persistence. The Cosign admission controller is a validating webhook that checks image signatures against trusted keys. If the signature is not valid or the key is untrusted, it rejects the pod creation request. This is the component that enforces the policy at admission time.

Why this answer

Admission controllers in the Kubernetes API server enforce policies before objects are persisted. The Cosign admission webhook validates image signatures against a configured list of trusted public keys. If the signature does not match a trusted key, the webhook denies the pod creation, preventing unsigned or untrusted images from running.

Exam trap

The trap here is assuming that image signature verification happens at the node level via the container runtime, when in fact it is typically enforced at admission time.

163
MCQhard

You have configured Kyverno to enforce that all Pods must have an image from a trusted registry. However, a newly created Pod is not being rejected even though it uses an untrusted image. What is the most likely reason?

A.Kyverno is not an admission controller; it only mutates resources
B.The Kyverno policy requires an external registry to compare images, which is unavailable
C.The Kyverno webhook is not invoked because the failure policy is set to Ignore or the resource is not matched by the policy's rules
D.The Pod was created by a Deployment controller, which bypasses admission control
AnswerC

The failurePolicy field in Kyverno's ValidatingWebhookConfiguration controls what happens when the webhook cannot be invoked or errors. If set to 'Ignore', any webhook failure is silently ignored and the request proceeds, so the policy would not block the Pod if, for example, the webhook endpoint is unavailable. Additionally, Kyverno policies can have match statements (e.g., specific kinds, namespaces, label selectors) — if this Pod does not match those criteria, the webhook receives the request but the policy simply does not apply to it.

Why this answer

Kyverno operates as a dynamic admission controller via a MutatingAdmissionWebhook or ValidatingAdmissionWebhook. If the webhook's failure policy is set to `Ignore`, the webhook will not block the Pod creation when it fails to invoke, and the Pod will be admitted. Additionally, if the policy's rules do not match the Pod (e.g., due to incorrect resource selection or namespace exclusion), the webhook will not be triggered, allowing untrusted images through.

Exam trap

The trap here is that candidates assume admission control is bypassed by controllers like Deployments, but in Kubernetes, all API requests—including those from controllers—go through admission webhooks; the real issue is usually a misconfigured failure policy or rule mismatch.

How to eliminate wrong answers

Option A is wrong because Kyverno is indeed an admission controller that can both mutate and validate resources; it does not only mutate. Option B is wrong because Kyverno policies can enforce image registry checks locally using pattern matching or regular expressions without requiring an external registry to be available. Option D is wrong because admission control applies to all API requests, including those from controllers like Deployments; the Deployment creates Pods via the API server, which invokes admission webhooks before persisting the resource.

164
MCQmedium

An admin runs 'kubectl run nginx --image=nginx' and the pod fails with 'ImagePullBackOff'. The cluster has an OPA/Gatekeeper constraint that only allows images from 'myregistry.io'. How can the admin quickly test the restriction?

A.Delete the OPA constraint
B.Add a label 'allowlist=true' to the pod
C.Use an image from 'myregistry.io/nginx:latest'
D.Use 'kubectl run nginx --image=nginx --validate=false'
AnswerC

If the OPA constraint's allowlist pattern permits images from 'myregistry.io', then specifying 'myregistry.io/nginx:latest' properly satisfies the image provenance check. The policy inspects the image field in the Pod spec and, if the registry matches the allowed pattern, the admission review passes; this is the correct way to test a compliance requirement without circumventing the control.

Why this answer

The OPA/Gatekeeper constraint explicitly restricts allowed images to those from 'myregistry.io'. By specifying an image from that registry (e.g., 'myregistry.io/nginx:latest'), the admin can quickly verify that the constraint permits compliant images. This tests the policy's intended behavior without altering or bypassing the constraint.

Exam trap

A common misconception is that '--validate=false' bypasses admission controllers, but it only affects client-side validation and has no effect on server-side webhooks like OPA/Gatekeeper.

How to eliminate wrong answers

Option A is wrong because deleting the OPA constraint removes the restriction entirely, which does not test the policy — it circumvents it. Option B is wrong because adding a label 'allowlist=true' to the pod does not affect image validation; OPA/Gatekeeper constraints typically evaluate image registry patterns, not arbitrary pod labels. Option D is wrong because '--validate=false' only skips client-side validation (e.g., schema checks) and does not bypass server-side admission webhooks like OPA/Gatekeeper, so the pod will still be rejected.

← PreviousPage 3 of 3 · 164 questions total

Ready to test yourself?

Try a timed practice session using only Supply Chain Security questions.