You are troubleshooting a container image vulnerability scan report that flagged a high-severity CVE in a base image layer. The development team wants to ensure that vulnerable container images are automatically prevented from being deployed to any namespace in the cluster. Which Kubernetes mechanism should you implement?
Trap 1: Enable resource quotas on the default namespace
Resource quotas cap aggregate CPU, memory and object counts per namespace; they inspect no image contents and cannot block a pod because of a CVE. It is tempting because quotas are the correct mechanism when the requirement is preventing one namespace from consuming cluster resources beyond its allocation.
Trap 2: Rotate the cluster certificate authority
Rotating the cluster certificate authority refreshes the trust material used for TLS authentication between components; it does not inspect image layers or block workloads. Its purpose is recovering from CA compromise or expiry. Admission control, via a policy engine such as Kyverno or Gatekeeper, is what evaluates image scan results before a pod is admitted.
Trap 3: Add network policies to restrict outbound CVE database queries
Network policies filter pod ingress and egress traffic; they never inspect image layers, so a vulnerable image still schedules and runs. It is tempting because network policies are the correct mechanism when the requirement is restricting which pods or external endpoints a workload may communicate with.
- A
Enable resource quotas on the default namespace
Why it fails: Resource quotas cap aggregate CPU, memory and object counts per namespace; they inspect no image contents and cannot block a pod because of a CVE. It is tempting because quotas are the correct mechanism when the requirement is preventing one namespace from consuming cluster resources beyond its allocation.
- B
Rotate the cluster certificate authority
Why it fails: Rotating the cluster certificate authority refreshes the trust material used for TLS authentication between components; it does not inspect image layers or block workloads. Its purpose is recovering from CA compromise or expiry. Admission control, via a policy engine such as Kyverno or Gatekeeper, is what evaluates image scan results before a pod is admitted.
- C
Add network policies to restrict outbound CVE database queries
Why it fails: Network policies filter pod ingress and egress traffic; they never inspect image layers, so a vulnerable image still schedules and runs. It is tempting because network policies are the correct mechanism when the requirement is restricting which pods or external endpoints a workload may communicate with.
- D
Configure a validating admission webhook to inspect image metadata and reject deployments with known CVEs
A validating admission webhook intercepts pod creation requests, queries image metadata against vulnerability data, and rejects any workload whose image contains known CVEs. This enforces prevention cluster-wide at admission time, satisfying the requirement to block deployment automatically.