The Kubernetes downward API only has the ability to express so many options as environment variables. The image consumed in a Pod is commonly needed to make the application aware of some logic it must take. This policy takes the value of the `image` field and adds it as an environment variable to Pods.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: add-image-as-env-varannotations:pod-policies.kyverno.io/autogen-controllers: nonepolicies.kyverno.io/title: Add Image as Environment Variablepolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.10.0-alpha.2kyverno.io/kubernetes-version: "1.26"policies.kyverno.io/subject: Podpolicies.kyverno.io/description: The Kubernetes downward API only has the ability to express so many options as environment variables. The image consumed in a Pod is commonly needed to make the application aware of some logic it must take. This policy takes the value of the `image` field and adds it as an environment variable to Pods.spec:rules:- name: pod-containers-inject-imagematch:any:- resources:kinds:- Podmutate:foreach:- list: request.object.spec.containers[]patchesJson6902: |-- op: addpath: /spec/containers/{{elementIndex}}/env/-value:name: K8S_IMAGEvalue: "{{ element.image }}"
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.