11. Kubernetes LivenessProbes and ReadinessProbes

Опубликовано: 22 Ноябрь 2024
на канале: iMustLearn
77
3

** Example:1 **
vi my-livenessprobe.yaml

apiVersion: v1
kind: Pod
metadata:
name: my-liveness-pod
spec:
containers:
name: my-busybox-lp
image: busybox
command: ['sh', '-c', "echo Hello, Kubernetes! && sleep 3600"]
livenessProbe:
exec:
command:
echo
check busybox container health
initialDelaySeconds: 5
periodSeconds: 5

kubectl create -f my-livenessprobe.yaml

kubectl get pods

kubectl describe po my-liveness-pod

** Example:2 **
vi my-readinessprobe.yaml

apiVersion: v1
kind: Pod
metadata:
name: my-readiness-pod
spec:
containers:
name: my-nginx-container-rp
image: nginx
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 5

kubectl create -f my-readinessprobe.yaml

kubectl describe pod my-readiness-pod