Security context and pod security
Two namespaces that enforce the restricted Pod Security Standard, with the `order-service` and `notification-service` carrying an explicit security context, Strimzi on its restricted provider, CloudNativePG as published and otel-lgtm outside the rule.
examples/31-security-context-and-pod-security/ labels edp and edp-kafka for the restricted level and runs Kafka, PostgreSQL and the order-service and notification-service under it. It accompanies Security context and pod security.
It is a kustomize overlay over the shared minikube cluster setup in examples/_k8s and a verify.sh, with no Java. The services are the unchanged order-service and notification-service images.
cd examples/31-security-context-and-pod-security
./verify.sh
What to observe
- Labels that enforce.
edpandedp-kafkaenforce, warn and audit at restricted, and the API server refuses a pod with no security context. - Applications that run as 185. The four fields and a read-only root filesystem with an emptyDir on
/tmp;id -ureports 185. - Kafka under the restricted provider. The operator, broker and controller pods are Running and compliant; with the default provider the Kafka pods are refused.
- PostgreSQL as published. The instance pod runs as uid 26 and the operator namespace passes a dry-run label.
- An exception with a record. A dry-run label on
edp-lgtmwarns that its pod violates the level, so the namespace stays unlabelled.
Infrastructure
Strimzi, Kafka, CloudNativePG and otel-lgtm from examples/_k8s on the edp minikube profile, plus the two services on NodePorts 30080 and 30082.