CKS trivy fs Practice Question
You are implementing supply chain security for container images. Which tool would you use to scan a local directory of Dockerfiles and Kubernetes manifests for known vulnerabilities?
⚠ Common exam trap
The trap is that candidates might think `trivy fs` only scans packages, but it can also scan configuration files like Dockerfiles and Kubernetes manifests for vulnerabilities. The exam tests the understanding that `trivy` is a multi-purpose tool, and `fs` is the appropriate subcommand for local directory scanning, not just `trivy image`.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
trivy fs
D is correct because `trivy fs` scans a local filesystem (including directories containing Dockerfiles and Kubernetes manifests) for known vulnerabilities. It parses these files, checks base images against vulnerability databases, and detects misconfigurations or CVEs. This tool is designed for supply chain security, covering both package vulnerabilities and infrastructure-as-code issues. The `fs` subcommand of trivy combines filesystem scanning with configuration analysis, making it suitable for the stated task.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
kubectl scan
Why it's wrong here
kubectl scan is not a real subcommand of kubectl; the Kubernetes CLI has no native vulnerability-scanning capability. Scanning container images requires direct access to image layers or a registry, which kubectl does not provide, so any such command would fail or require a third-party plugin. Its absence from the standard toolset makes it invalid for supply-chain vulnerability scanning.
- ✗
syft
Why it's wrong here
syft generates a Software Bill of Materials (SBOM) by enumerating the packages and dependencies present in a directory or image, but it does not perform vulnerability analysis. While an SBOM is a crucial input for security workflows, syft alone does not compare component versions against known CVE databases. Therefore, it is an inventory tool, not a vulnerability scanner.
- ✗
cosign sign
Why it's wrong here
cosign sign is designed for cryptographic signing of container images to ensure integrity and provenance, not for discovering vulnerabilities. It attaches a signature that verifies the image's origin and guards against tampering, but it does not analyze installed packages or OS layers for known CVEs. Thus, it addresses authenticity, not vulnerability detection.
- ✓
trivy fs
Why this is correct
trivy fs is a valid and appropriate choice because it scans local filesystem paths, including Dockerfiles and Kubernetes manifests, for vulnerabilities and misconfigurations. It parses the base image references and dependency files in those directories, then cross-references them against vulnerability databases, and also performs configuration checks for insecure settings. This makes it a comprehensive scanner for code and Infrastructure-as-Code artifacts in a supply-chain context.
Go deeper
Related to this question
About these practice questions
This CKS question is part of Courseiva's 845-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKS practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKS exam.