startupProbe-livenessProbe-readinessProbe-httpGet 案例
cat 28-startupProbe-livenessProbe-readinessProbe-httpGet.yaml
kind: Pod
apiVersion: v1
metadata:
name: probe-startup-liveness-readiness-httpget
labels:
school: baimei
class: dashu
spec:
containers:
- name: web
image: harbor.baimei.com/baimei-web/nginx:1.25.1-alpine
# 指定健康检查探针,若未指定默认成功,若定义该探针,检测失败则会重启容器,即重新创建容器。
livenessProbe:
httpGet:
port: 80
path: /dashu.html
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
# 指定就绪探针,若未指定则默认成功,若定义该探针,检测失败则会将Pod标记为未就绪状态,而未就绪的Pod是不会记录到svc的ep列表中。
readinessProbe:
httpGet:
port: 80
path: /baimei.html
failureThreshold: 3
initialDelaySeconds: 20
periodSeconds: 1
successThreshold: 1
timeoutSeconds: 1
# 指定启动探针,若定义了该探针,会优先通过该探针检测,若检测成功,再去执行readinessProbe和livenessProbe探针。
# 若没有定义该探针,则默认为成功。
startupProbe:
httpGet:
port: 80
path: /start.html
failureThreshold: 3
initialDelaySeconds: 40
periodSeconds: 1
successThreshold: 1
timeoutSeconds: 1
---
apiVersion: v1
kind: Service
metadata:
name: probe-startup-readiness-liveness-httpget
spec:
type: ClusterIP
selector:
class: dashu
ports:
- port: 8888
targetPort: 80
欢迎来撩 : 汇总all