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 →
- Terraform: run Checkov or Trivy config scanning, plus custom rules in OPA/Conftest against
terraform show -jsonoutput.
terraform show -json tfplan > plan.json
conftest test plan.json -p policy/terraform
- Kubernetes manifests: Conftest or
kyverno applyagainst rendered Helm or Kustomize output in CI. - Cluster: the same Kyverno policies at admission, so nothing bypasses CI.
- Start in warn mode, publish the violation list, then switch to blocking.
- 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.
More on Pipelines at scale
The CI pipeline takes 45 minutes. Developers want it under 10. How do you approach it?IntermediateYou have a monorepo with 40 services. Every commit builds and tests all of them. How do you fix that?AdvancedFlaky tests fail 1 in 5 runs and developers just click "re-run". How do you fix this culture and the tests?BeginnerYour self-hosted GitHub runners can't keep up at peak and sit idle at night. How do you run them at scale?AdvancedDocker builds in CI take 12 minutes because every runner starts with an empty cache. How do you speed them up?IntermediateHow do you secure the software supply chain from commit to production?Advanced