Unit Testing Your Kubernetes Configurations Using Open Policy Agent
summary
Unit tests run Open Policy Agent policies against rendered Kubernetes manifests and other structured outputs, catching issues before cluster deploy. The workflow uses regol (uploader spelling) policies and OPA’s test harness, a local CLI called contest to check manifests from kubectl/Helm/Kustomize/Pulumi or Terraform (terraform show → JSON), and gates as deny or warn. Examples include denying containers without runAsNonRoot and requiring specific labels; bundles publish policies to OCI registries via bundle bar for reuse.
AI-written summary · about
chapters (9)
- 0:00Introduction to the talk
- 2:05What is Open Policy Agent
- 4:25Shifting left with testing
- 7:35Introduction to Conftest
- 13:31Working with the Rego language
- 17:06Sharing policies and bundles
- 22:46Testing infrastructure configurations
- 26:08Terraform and beyond
- 32:01Conclusion and future outlook
related talks
25mPolicing Your Kubernetes Clusters with Open Policy Agent (OPA) - Mark Puddick & Amith Nambiar
37mDeep-dive into Open Policy Agent + Conftest + GateKeeper: Kubernetes Policy in Action
28mDeep-dive into Open Policy Agent + Conftest + GateKeeper
19mDynamic Authorization and Policy Control for Your Kubernetes Cluster
38mOPA for the cloud natives
30mOpen Policy Agent Intro
41mYou Shall Not Pass! Policy Compliance with OPA Gatekeeper
36mOPA for the cloud natives
