Practice Questions: Supply Chain Security
Domain Weight
Supply Chain Security accounts for 20% of the CKS exam -- tied for the highest weight. These 25 questions cover all topics in this domain with exam-realistic scenarios and hands-on tasks.
Question 1
Difficulty: Easy
Scenario: A security team has requested that you check the nginx:1.21 image for vulnerabilities before deploying it to the production cluster.
Task: Use Trivy to scan the nginx:1.21 image and identify only CRITICAL and HIGH severity vulnerabilities. Save the output in JSON format to /root/nginx-scan.json.
Question 2
Difficulty: Easy
Scenario: You need to find which container images running in the webapp namespace have known CRITICAL vulnerabilities.
Task: List all unique container images used by Pods in the webapp namespace. Then scan each image with Trivy, filtering for CRITICAL severity only, and save the names of images with CRITICAL vulnerabilities to /root/critical-images.txt (one image per line).
Question 3
Difficulty: Easy
Scenario: A developer has submitted a Pod manifest for review before deployment.
Task: Use kubesec to scan the file /root/pod-manifest.yaml. Identify the security score. If the score is negative, document all critical issues found to /root/kubesec-findings.txt.
Question 4
Difficulty: Easy
Scenario: The production cluster needs to pull images from a private registry at registry.internal.io.
Task:
- Create an ImagePullSecret named
registry-secretin theproductionnamespace with the following credentials:- Server:
registry.internal.io - Username:
k8s-prod - Password:
SecureP@ss2024 - Email:
devops@company.com
- Server:
- Patch the
defaultServiceAccount in theproductionnamespace to use this ImagePullSecret.
Question 5
Difficulty: Easy
Scenario: You have been given a Dockerfile at /root/app/Dockerfile to review.
Task: Identify all security issues in the Dockerfile and fix them. The Dockerfile should:
- Use a specific version tag (not
latest) - Run as a non-root user
- Use
COPYinstead ofADD - Not contain any hardcoded secrets
Question 6
Difficulty: Medium
Scenario: The nginx:1.25 image was previously approved, but a new CVE has been discovered. You need to determine if the image is affected.
Task:
- Scan
nginx:1.25with Trivy for vulnerabilities, showing only those that have a fix available - Save the output to
/root/fixable-vulns.txt - Count the total number of CRITICAL and HIGH vulnerabilities that have fixes, and write the count to
/root/vuln-count.txt
Question 7
Difficulty: Medium
Scenario: Your organization requires that all containers in the secure namespace use images only from the registry.company.com registry.
Task: Configure an OPA Gatekeeper constraint that denies any Pod in the secure namespace if its container images do not start with registry.company.com/. The ConstraintTemplate is already installed as K8sAllowedRegistries. Create only the Constraint resource.
Question 8
Difficulty: Medium
Scenario: The API server needs to be configured to use an ImagePolicyWebhook admission controller. The webhook service is running at https://image-policy.default.svc:443/validate and the following files already exist on the control plane node:
- Webhook CA certificate:
/etc/kubernetes/pki/webhook-ca.crt - API server client cert:
/etc/kubernetes/pki/apiserver.crt - API server client key:
/etc/kubernetes/pki/apiserver.key
Task:
- Create the webhook kubeconfig file at
/etc/kubernetes/pki/admission_kubeconfig.yaml - Create the AdmissionConfiguration file at
/etc/kubernetes/pki/admission_configuration.yamlwithdefaultAllow: false - Update the kube-apiserver static pod manifest to enable ImagePolicyWebhook
Question 9
Difficulty: Medium
Scenario: A running Pod named suspicious-pod in the default namespace is using an image that may have been tampered with.
Task:
- Identify the image used by
suspicious-pod - Scan the image with Trivy for vulnerabilities and secrets
- Save the full scan results to
/root/suspicious-scan.jsonin JSON format - If CRITICAL vulnerabilities are found, delete the Pod
Question 10
Difficulty: Medium
Scenario: Your team uses a multi-stage Dockerfile to build a Go application, but the final image is too large and contains unnecessary tools.
Task: Rewrite the Dockerfile at /root/go-app/Dockerfile to:
- Use a multi-stage build
- Use
golang:1.22-alpineas the builder stage - Use
gcr.io/distroless/static:nonrootas the final stage - Run as a non-root user (UID 65532)
- Only copy the compiled binary to the final stage
Question 11
Difficulty: Medium
Scenario: You need to scan Kubernetes manifests in the /root/manifests/ directory for security misconfigurations before applying them.
Task:
- Use Trivy to scan the directory for configuration issues
- Save the results to
/root/config-scan.txt - Identify and fix any HIGH severity misconfigurations in the manifests
Question 12
Difficulty: Medium
Scenario: A Deployment in the production namespace is using mutable image tags. The security policy requires all production images to use SHA256 digests.
Task:
- Identify the Deployment named
web-frontendin theproductionnamespace - Find the SHA256 digest for the image it currently uses
- Update the Deployment to use the image digest instead of the tag
Question 13
Difficulty: Medium
Scenario: Your cluster needs to ensure that images are always pulled from the registry, never served from node cache.
Task:
- Enable the
AlwaysPullImagesadmission controller on the API server - Verify that the admission controller is active by checking the API server configuration
- Create a test Pod to confirm the
imagePullPolicyis being enforced
Question 14
Difficulty: Medium
Scenario: A saved container image archive exists at /root/images/app-image.tar on the control plane node.
Task:
- Scan the image archive with Trivy
- List all CRITICAL and HIGH CVEs found
- Save the CVE IDs to
/root/cve-list.txt(one per line)
Question 15
Difficulty: Medium
Scenario: Multiple namespaces in the cluster need access to different private registries. Set up the following:
Task:
- Create ImagePullSecret
gcr-secretin namespaceteam-aforgcr.iowith username_json_keyand password from file/root/gcr-key.json - Create ImagePullSecret
ecr-secretin namespaceteam-bfor123456789.dkr.ecr.us-east-1.amazonaws.comwith usernameAWSand passwordecr-token-2024 - Attach each secret to the
defaultServiceAccount in their respective namespaces
Question 16
Difficulty: Hard
Scenario: The security team requires a complete supply chain gate: images must be scanned AND must come from an approved registry before being admitted to the cluster.
Task:
- Configure ImagePolicyWebhook on the API server (webhook at
https://policy-webhook.security.svc:443/check) - Create an OPA Gatekeeper Constraint to allow images only from
harbor.company.com/ - Ensure
defaultAllowis set tofalsefor the webhook - Verify both controls are working by testing with allowed and denied images
Question 17
Difficulty: Hard
Scenario: You have discovered that several Pods across the cluster are running images with CRITICAL vulnerabilities. You need to perform a cluster-wide audit.
Task:
- List all unique container images across all namespaces in the cluster
- Scan each image with Trivy (CRITICAL severity only)
- Save a report to
/root/cluster-audit.txtwith format:NAMESPACE/POD_NAME IMAGE_NAME CVE_COUNT - Delete any Pods running images with more than 5 CRITICAL vulnerabilities
Question 18
Difficulty: Hard
Scenario: An existing ImagePolicyWebhook configuration is not working. The API server fails to start after the configuration was added.
Task:
- Investigate the API server logs to identify the issue
- Fix the ImagePolicyWebhook configuration
- Ensure the API server starts successfully with ImagePolicyWebhook enabled
- Verify the webhook is functioning by attempting to deploy a test Pod
Question 19
Difficulty: Hard
Scenario: You need to create a comprehensive .trivyignore file and configure Trivy scanning for the CI/CD pipeline.
Task:
- The following CVEs have been accepted as risk:
CVE-2023-44487,CVE-2023-39325,CVE-2024-0727 - Create a
.trivyignorefile at/root/.trivyignorewith these CVEs - Scan the image
python:3.11-slimusing this ignore file, showing only CRITICAL and HIGH vulnerabilities with no unfixed vulnerabilities - Save the results to
/root/python-scan.jsonin JSON format
Question 20
Difficulty: Hard
Scenario: A Dockerfile at /root/secure-build/Dockerfile has multiple security issues and builds a Node.js application.
Task: Completely rewrite the Dockerfile following all security best practices:
- Multi-stage build with
node:20-slimas builder andgcr.io/distroless/nodejs20-debian12:nonrootas runtime - Pin the base image to a specific digest
- Use
COPYexclusively (noADD) - Install production dependencies only (
npm ci --only=production) - Run as non-root user (UID 65532)
- Include a
.dockerignorefile that excludes.git,.env,node_modules,test/, and*.md - No hardcoded secrets or environment variables with sensitive data
Question 21
Difficulty: Hard
Scenario: Configure Harbor-style registry access control for the cluster.
Task:
- Create namespace
team-frontendwith labelteam=frontend - Create namespace
team-backendwith labelteam=backend - Create ImagePullSecret for
harbor.company.comin both namespaces with different robot accounts:team-frontend: usernamerobot$frontend-pull, passwordfrontend-token-2024team-backend: usernamerobot$backend-pull, passwordbackend-token-2024
- Create an OPA Gatekeeper Constraint that:
- In
team-frontendnamespace: only allows images fromharbor.company.com/frontend/ - In
team-backendnamespace: only allows images fromharbor.company.com/backend/
- In
Question 22
Difficulty: Hard
Scenario: You need to analyze a suspicious image and determine if it has been tampered with.
Task:
- The image
registry.company.com/app:v2.3is suspected of being compromised - Scan it with Trivy for vulnerabilities, misconfigurations, and secrets
- Check the image layers using
docker historyortrivy image --list-all-pkgs - Save all findings to
/root/forensics-report.txt - If the image contains embedded secrets, document them
Question 23
Difficulty: Medium
Scenario: An existing AdmissionConfiguration file at /etc/kubernetes/pki/admission_configuration.yaml has defaultAllow: true which is insecure.
Task:
- Change
defaultAllowtofalse - Adjust the
allowTTLto 50 seconds anddenyTTLto 50 seconds - Set
retryBackoffto 500 milliseconds - Restart the API server and verify the change took effect
Question 24
Difficulty: Hard
Scenario: Implement a complete supply chain security workflow for a new application.
Task:
- Review the Dockerfile at
/root/new-app/Dockerfileand fix all security issues - Build the image and tag it as
harbor.company.com/production/new-app:v1.0 - Scan the built image with Trivy -- it must have zero CRITICAL vulnerabilities
- Create an ImagePullSecret in the
productionnamespace forharbor.company.com - Deploy the application using the secure image with proper
imagePullSecrets - Verify the Pod is running successfully
Question 25
Difficulty: Hard
Scenario: A combination of supply chain security controls needs to be implemented across the cluster.
Task:
- Enable
AlwaysPullImagesadmission controller on the API server - Configure ImagePolicyWebhook with
defaultAllow: false(webhook athttps://image-checker.kube-system.svc:443/validate) - Create a Gatekeeper constraint to deny images using the
:latesttag - Create ImagePullSecrets for
harbor.company.comin thedefault,production, andstagingnamespaces - Verify all controls are working:
- Test that
imagePullPolicyis set toAlwayson new Pods - Test that unauthorized images are blocked
- Test that
:latesttag is rejected - Test that private images can be pulled with correct credentials
- Test that
Exam Strategy
- Easy questions (1-5): Target 3-5 minutes each. These are quick wins -- do them first.
- Medium questions (6-15): Target 5-8 minutes each. These form the bulk of your score.
- Hard questions (16-25): Target 8-12 minutes each. Attempt after completing easier ones.
- Total domain time budget: ~24 minutes (20% of 120 minutes).
- Prioritize: ImagePullSecrets, Trivy scanning, and kubesec -- they appear most frequently.