mirror of
https://gitlab.kube.huskypup.net/Scooby/Homelabv4.git
synced 2026-08-21 05:26:49 +00:00
30 lines
747 B
YAML
30 lines
747 B
YAML
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: disallow-nodeport-services
|
|
annotations:
|
|
policies.kyverno.io/title: Disallow NodePort Services
|
|
policies.kyverno.io/category: Zero Trust
|
|
policies.kyverno.io/severity: medium
|
|
spec:
|
|
validationFailureAction: Enforce
|
|
background: true
|
|
rules:
|
|
- name: disallow-nodeport
|
|
match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Service
|
|
exclude:
|
|
any:
|
|
- resources:
|
|
namespaces:
|
|
- kube-system
|
|
- istio-system
|
|
validate:
|
|
message: "NodePort services are not allowed. Use ClusterIP or LoadBalancer."
|
|
pattern:
|
|
spec:
|
|
type: "!NodePort"
|