1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 09:26:54 +00:00
kyverno/samples/best_practices/require_probes.yaml

29 lines
990 B
YAML
Raw Normal View History

2019-10-09 17:49:00 -07:00
apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
2019-11-10 21:18:17 -08:00
name: require-pod-probes
2019-10-11 18:57:16 -07:00
annotations:
2019-11-11 18:21:16 -08:00
policies.kyverno.io/category: Workload Management
2019-11-10 21:18:17 -08:00
policies.kyverno.io/description: Liveness and readiness probes need to be configured to
correctly manage a pods 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 recieve network traffic.
2019-10-09 17:49:00 -07:00
spec:
rules:
2019-11-10 21:18:17 -08:00
- name: validate-livenessProbe-readinessProbe
2019-10-09 17:49:00 -07:00
match:
resources:
kinds:
- Pod
validate:
message: "Liveness and readiness probes are required"
pattern:
spec:
containers:
- livenessProbe:
periodSeconds: ">0"
readinessProbe:
periodSeconds: ">0"