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 performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.