Kubernetes Namespaces are an optional feature that provide a way to segment and isolate cluster resources across multiple applications and users. As a best practice, workloads should be isolated with Namespaces. Namespaces should be required and the default (empty) Namespace should not be used. This policy validates that Pods specify a Namespace name other than `default`. Rule auto-generation is disabled here due to Pod controllers need to specify the `namespace` field under the top-level `metadata` object and not at the Pod template level.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: disallow-default-namespaceannotations:pod-policies.kyverno.io/autogen-controllers: nonepolicies.kyverno.io/title: Disallow Default Namespacepolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/category: Multi-Tenancypolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpolicies.kyverno.io/description: Kubernetes Namespaces are an optional feature that provide a way to segment and isolate cluster resources across multiple applications and users. As a best practice, workloads should be isolated with Namespaces. Namespaces should be required and the default (empty) Namespace should not be used. This policy validates that Pods specify a Namespace name other than `default`. Rule auto-generation is disabled here due to Pod controllers need to specify the `namespace` field under the top-level `metadata` object and not at the Pod template level.spec:validationFailureAction: Auditbackground: truerules:- name: validate-namespacematch:any:- resources:kinds:- Podvalidate:message: Using 'default' namespace is not allowed.pattern:metadata:namespace: "!default"- name: validate-podcontroller-namespacematch:any:- resources:kinds:- DaemonSet- Deployment- Job- StatefulSetvalidate:message: Using 'default' namespace is not allowed for pod controllers.pattern:metadata:namespace: "!default"
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.