- Run the below command to Register pod security policy feature preview
az feature register --name PodSecurityPolicyPreview --namespace Microsoft.ContainerService
- Enable pod security policy on an AKS cluster
az aks update \
--resource-group rg-aks-demo \
--name aks-cf-demo-eus \
--enable-pod-security-policy
To view the policies available
kubectl get psp
kubectl apply -f https://raw.githubusercontent.com/open-policy-agent/gatekeeper/master/deploy/gatekeeper.yaml
kubectl delete -f https://raw.githubusercontent.com/open-policy-agent/gatekeeper/master/deploy/gatekeeper.yaml
kubectl get constrainttemplates
kubectl delete constrainttemplates 'k8srequiredlabels"
kubectl delete -f constraints
kubectl delete -f templates