How do you control which images may run in a cluster of 200 teams?
AdvancedScenarioContainer and IaC Security
Answer
Situation read → You need central policy that does not slow teams down and cannot be bypassed from kubectl.
What I'd do →
- Allow only approved registries via admission control (Kyverno or Gatekeeper).
- Require cosign signatures from the CI identity using keyless verification:
verifyImages:
- imageReferences: ["registry.example.com/*"]
attestors:
- entries:
- keyless:
issuer: https://token.actions.githubusercontent.com
subject: https://github.com/example-org/*
- Roll out in
Auditmode first, publish reports, then switch toEnforce. - Provide exemptions by namespace label with expiry.
Why → Admission is the last gate before execution.
Interview tip → Mention audit-before-enforce rollout.
More on Container and IaC Security
A team asks whether to use `ubuntu`, `alpine` or a distroless base image. How do you advise?Beginner`trivy image` shows 300 vulnerabilities in your app image. How do you bring this down?BeginnerA Dockerfile runs the app as root. How do you fix it and prove the fix?IntermediateCheckov fails a Terraform PR because an S3 bucket allows public access. What do you change?BeginnerHow do you set up image scanning so nothing vulnerable reaches production?IntermediateAn image passed scanning three weeks ago and runs in production. A new critical CVE is published today. What happens next?Intermediate