apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: example-security
namespace: ns1 (1)
spec:
groups:
- name: pod-security-policy
rules:
- alert: "ProjectNotEnforcingRestrictedPolicy" (2)
for: 5m (3)
expr: kube_namespace_labels{namespace!~"(openshift|kube).*|default",label_pod_security_kubernetes_io_enforce!="restricted"} (4)
annotations:
message: "Restricted policy not enforced. Project {{ $labels.namespace }} does not enforce the restricted pod security policy." (5)
labels:
severity: warning (6)