A Kubernetes Service of type NodePort uses a host port to receive traffic from any source. A NetworkPolicy cannot be used to control traffic to host ports. Although NodePort Services can be useful, their use must be limited to Services with additional upstream security checks. This policy validates that any new Services do not use the `NodePort` type.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: restrict-nodeportannotations:policies.kyverno.io/title: Disallow NodePortpolicies.kyverno.io/category: Best Practicespolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Servicepolicies.kyverno.io/description: A Kubernetes Service of type NodePort uses a host port to receive traffic from any source. A NetworkPolicy cannot be used to control traffic to host ports. Although NodePort Services can be useful, their use must be limited to Services with additional upstream security checks. This policy validates that any new Services do not use the `NodePort` type.spec:validationFailureAction: Auditbackground: truerules:- name: validate-nodeportmatch:any:- resources:kinds:- Servicevalidate:message: Services of type NodePort are not allowed.pattern:spec:"=(type)": "!NodePort"
This policy prevents the use of the default project in an Application.
Services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
This policy prevents updates to the project field after an Application is created.