How do you add policy checks (no public buckets, no privileged pods, required labels) to pipelines?

IntermediateScenarioPipelines at scale
Answer

Situation read → Policies written in a wiki get ignored. Policies written as code run on every PR and fail fast.

What I'd do →

  1. Terraform: run Checkov or Trivy config scanning, plus custom rules in OPA/Conftest against terraform show -json output.
terraform show -json tfplan > plan.json
conftest test plan.json -p policy/terraform
  1. Kubernetes manifests: Conftest or kyverno apply against rendered Helm or Kustomize output in CI.
  2. Cluster: the same Kyverno policies at admission, so nothing bypasses CI.
  3. Start in warn mode, publish the violation list, then switch to blocking.
  4. Keep policies in a shared repo with tests and an exceptions process (documented, time-limited).

Why → CI gives fast feedback; admission control is the backstop for anything applied outside CI.

Interview tip → Say "same policy in CI and at admission"; it shows defence in depth.

All Real-World Interview questions Roadmap: Interview readiness

More on Pipelines at scale