Especially in cloud provider environments, a Service having type LoadBalancer will cause the provider to respond by creating a load balancer somewhere in the customer account. This adds cost and complexity to a deployment. Without restricting this ability, users may easily overrun established budgets and security practices set by the organization. This policy restricts use of the Service type LoadBalancer.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: no-loadbalancer-serviceannotations:policies.kyverno.io/title: Disallow Service Type LoadBalancerpolicies.kyverno.io/category: Samplepolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Servicepolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/description: Especially in cloud provider environments, a Service having type LoadBalancer will cause the provider to respond by creating a load balancer somewhere in the customer account. This adds cost and complexity to a deployment. Without restricting this ability, users may easily overrun established budgets and security practices set by the organization. This policy restricts use of the Service type LoadBalancer.spec:validationFailureAction: Auditbackground: truerules:- name: no-LoadBalancermatch:any:- resources:kinds:- Servicevalidate:message: Service of type LoadBalancer is not allowed.pattern:spec:type: "!LoadBalancer"
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.