Ingress resources should only allow secure traffic by disabling HTTP and therefore only allowing HTTPS. This policy requires that all Ingress resources set the annotation `kubernetes.io/ingress.allow-http` to `"false"` and specify TLS in the spec.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-ingress-httpsannotations:policies.kyverno.io/title: Require Ingress HTTPSpolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.9.0kyverno.io/kubernetes-version: "1.24"policies.kyverno.io/subject: Ingresspolicies.kyverno.io/description: Ingress resources should only allow secure traffic by disabling HTTP and therefore only allowing HTTPS. This policy requires that all Ingress resources set the annotation `kubernetes.io/ingress.allow-http` to `"false"` and specify TLS in the spec.spec:background: truevalidationFailureAction: Auditrules:- name: has-annotationmatch:any:- resources:kinds:- Ingresspreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: The kubernetes.io/ingress.allow-http annotation must be set to false.pattern:metadata:annotations:kubernetes.io/ingress.allow-http: "false"- name: has-tlsmatch:any:- resources:kinds:- Ingresspreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: TLS must be defined.deny:conditions:all:- key: tlsoperator: AnyNotInvalue: "{{ request.object.spec.keys(@) }}"
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.