Liveness and readiness probes need to be configured to correctly manage a Pod's lifecycle during deployments, restarts, and upgrades. For each Pod, a periodic `livenessProbe` is performed by the kubelet to determine if the Pod's containers are running or need to be restarted. A `readinessProbe` is used by Services and Deployments to determine if the Pod is ready to receive network traffic. This policy validates that all containers have one of livenessProbe, readinessProbe, or startupProbe defined.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-pod-probesannotations:pod-policies.kyverno.io/autogen-controllers: DaemonSet,Deployment,StatefulSetpolicies.kyverno.io/title: Require Pod Probespolicies.kyverno.io/category: Best Practices, EKS Best Practicespolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpolicies.kyverno.io/description: Liveness and readiness probes need to be configured to correctly manage a Pod's lifecycle during deployments, restarts, and upgrades. For each Pod, a periodic `livenessProbe` is performed by the kubelet to determine if the Pod's containers are running or need to be restarted. A `readinessProbe` is used by Services and Deployments to determine if the Pod is ready to receive network traffic. This policy validates that all containers have one of livenessProbe, readinessProbe, or startupProbe defined.spec:validationFailureAction: Auditbackground: truerules:- name: validate-probesmatch:any:- resources:kinds:- Podpreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: Liveness, readiness, or startup probes are required for all containers.foreach:- list: request.object.spec.containers[]deny:conditions:all:- key: livenessProbeoperator: AllNotInvalue: "{{ element.keys(@)[] }}"- key: startupProbeoperator: AllNotInvalue: "{{ element.keys(@)[] }}"- key: readinessProbeoperator: AllNotInvalue: "{{ element.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.