A Pod PriorityClass is used to provide a guarantee on the scheduling of a Pod relative to others. This policy adds the priorityClassName of `non-production` to any Pod controller deployed into a Namespace that does not have the label env=production.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: add-pod-priorityclassnameannotations:policies.kyverno.io/title: Add Pod priorityClassNamepolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpod-policies.kyverno.io/autogen-controllers: nonekyverno.io/kyverno-version: 1.7.1policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.23"policies.kyverno.io/description: A Pod PriorityClass is used to provide a guarantee on the scheduling of a Pod relative to others. This policy adds the priorityClassName of `non-production` to any Pod controller deployed into a Namespace that does not have the label env=production.spec:background: falserules:- name: add-priorityclass-controllersmatch:any:- resources:kinds:- Deployment- DaemonSet- StatefulSet- JobnamespaceSelector:matchExpressions:- key: envoperator: NotInvalues:- productionmutate:patchesJson6902: |-- op: removepath: '/spec/template/spec/priority'- op: addpath: /spec/template/spec/priorityClassNamevalue: 'non-production'- name: add-priorityclass-cronjobsmatch:any:- resources:kinds:- CronJobnamespaceSelector:matchExpressions:- key: envoperator: NotInvalues:- productionmutate:patchesJson6902: |-- op: removepath: '/spec/jobTemplate/spec/template/spec/priority'- op: addpath: /spec/jobTemplate/spec/template/spec/priorityClassNamevalue: 'non-production'
The Kubernetes cluster autoscaler does not evict pods that use hostPath or emptyDir volumes. To allow eviction of these pods, the annotation cluster-autoscaler.kubernetes.io/safe-to-evict=true must be added to the pods.
The Kubernetes cluster autoscaler does not evict pods that use hostPath or emptyDir volumes. To allow eviction of these pods, the annotation cluster-autoscaler.kubernetes.io/safe-to-evict=true must be added to the pods.
CAST AI will not downscale a node that includes a pod with the autoscaling.cast.ai/removal-disabled="true" label on it, this protects sensitive workloads from being evicted and can be attributed to any pod to protect against unwanted downscaling. This policy will mutate jobs and cronjobs to add the removal-disabled label to protect against eviction.