CKS · Question #36
Cluster: scanner Master node: controlplane Worker node: worker1 You can switch the cluster/configuration context using the following command: [desk@cli] $ kubectl config use-context scanner Given…
This task tests your ability to use Trivy to scan container images running in a Kubernetes namespace for High/Critical CVEs, then remediate by deleting the vulnerable Pods.
Question
Explanation
This task tests your ability to use Trivy to scan container images running in a Kubernetes namespace for High/Critical CVEs, then remediate by deleting the vulnerable Pods.
Approach. First, switch context with kubectl config use-context scanner, then SSH to the master node (controlplane). Run kubectl get pods -n nato -o jsonpath='{range .items[*]}{.spec.containers[*].image}{"\n"}{end}' to list all images used in the nato namespace. For each image, run trivy image --severity HIGH,CRITICAL <image-name> on the master node. Any image that returns findings at HIGH or CRITICAL severity means the Pod using it must be deleted with kubectl delete pod <pod-name> -n nato. Repeat for all Pods until only clean images remain in the namespace.
Concept tested. Container image vulnerability scanning with Trivy in a Kubernetes cluster - specifically identifying running workloads with HIGH/CRITICAL CVEs and performing remediation by removing the offending Pods. This is a core CKS (Certified Kubernetes Security Specialist) skill covering supply chain security and runtime risk reduction.
Reference. https://aquasecurity.github.io/trivy/latest/docs/target/container_image/
Topics
Community Discussion
No community discussion yet for this question.