Files
Homelabv4/infrastructure/kyverno/policies/disallow-default-namespace.yaml
T
2026-03-09 20:21:35 -05:00

34 lines
1003 B
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-default-namespace
annotations:
policies.kyverno.io/title: Disallow Default Namespace
policies.kyverno.io/category: DoD STIG
policies.kyverno.io/severity: medium
policies.kyverno.io/description: >-
STIG V-242383: Workloads must not run in the default namespace.
The default namespace lacks proper RBAC and network policy boundaries.
spec:
validationFailureAction: Enforce
background: true
rules:
- name: validate-namespace
match:
any:
- resources:
kinds:
- Pod
- Deployment
- StatefulSet
- DaemonSet
- Job
- CronJob
namespaces:
- default
validate:
message: >-
Workloads must not run in the default namespace (STIG V-242383).
Create a dedicated namespace for your application.
deny: {}