Cases where RBAC may be applied at a higher level and where Namespace-level protections may be necessary can be accomplished with a separate policy. For example, one may want to protect creates, updates, and deletes on only a single Namespace. This policy will block creates, updates, and deletes to any Namespace labeled with `freeze=true`. Caution should be exercised when using rules which match on all kinds (`"*"`) as this will involve, for larger clusters, a substantial amount of processing on Kyverno's part. Additional resource requests and/or limits may be required.
apiVersion: kyverno.io/v2beta1kind: ClusterPolicymetadata:name: namespace-protectionannotations:policies.kyverno.io/title: Namespace Protectionpolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Namespacekyverno.io/kyverno-version: 1.9.0policies.kyverno.io/minversion: 1.9.0kyverno.io/kubernetes-version: "1.24"policies.kyverno.io/description: Cases where RBAC may be applied at a higher level and where Namespace-level protections may be necessary can be accomplished with a separate policy. For example, one may want to protect creates, updates, and deletes on only a single Namespace. This policy will block creates, updates, and deletes to any Namespace labeled with `freeze=true`. Caution should be exercised when using rules which match on all kinds (`"*"`) as this will involve, for larger clusters, a substantial amount of processing on Kyverno's part. Additional resource requests and/or limits may be required.spec:validationFailureAction: Enforcebackground: falserules:- name: check-freezematch:any:- resources:kinds:- "*"namespaceSelector:matchExpressions:- key: freezeoperator: Invalues:- "true"validate:message: This Namespace is frozen and no modifications may be performed.deny: {}
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.