This is a K8S operator that automatically binds a subject to a pod security policy via a PodSecurityPolicyBinding custom resource
- Setup a dedicated
operatornamespace and configure the operator into it:
kubectl -n operator apply -f deploy/setup-operator.yaml
- Create the "deployer" namespace and setup the deployer service account (in our example the namespace is called
foo)
kubectl -n foo apply -f deploy/deployer_service_account.yaml
- Create the
PodSecurityPolicyBindingcustom resource into theoperatornamespace (so that the operator configures thedeployeruser with the pod security policy)
kubectl -n operator apply -f deploy/crds/map_deployer_to_podsecurity_cr.yaml
- Create a pod as
deployer
kubectl -n foo --as system:serviceaccount:foo:deployer apply -f deploy/pod.yml
- Success The pod has both seccomp and apparomour profiles enabled