Interview Prep/Kubernetes/Security Hardening & Compliance

How would you enforce "only signed images from our registry" in the cluster?

IntermediateProductionSecurity Hardening & Compliance
Answer

A Kyverno ClusterPolicy with verifyImages checks the Cosign signature against a trusted identity (OIDC issuer and subject of your CI) and rejects others, together with a rule restricting registries to 123456789012.dkr.ecr.*.amazonaws.com/*. Start in Audit mode, review violations, then switch to Enforce.

validationFailureAction: Enforce
rules:
- name: verify-signature
  verifyImages:
  - imageReferences: ["123456789012.dkr.ecr.ap-south-1.amazonaws.com/*"]
All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Security Hardening & Compliance