介绍
就绪探针
就绪探针旨在让Kubernetes知道你的应用是否准备好为请求提供服务。Kubernetes只有在就绪探针通过才会把流量转发到Pod。如果就绪探针检测失败,Kubernetes将停止向该容器发送流量,直到它通过。
存活探针
Liveness探测器是让Kubernetes知道你的应用是否活着。如果你的应用还活着,那么Kubernetes就让它继续存在。如果你的应用程序已经死了,Kubernetes将移除Pod并重新启动一个来替换它。
配置
存活检查 HTTP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
   | containers:   - name: xxx     image: xxx
           livenessProbe:       httpGet:         scheme: HTTP                      path: /actuator/health            port: 8080                      initialDelaySeconds: 30           periodSeconds: 10                 timeoutSeconds: 1                 successThreshold: 1               failureThreshold: 3        
 
  | 
 
就绪检查 HTTP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
   | containers:   - name: xxx     image: xxx
           readinessProbe:       httpGet:         scheme: HTTP                      path: /actuator/health            port: 8080                      initialDelaySeconds: 30           periodSeconds: 10                 timeoutSeconds: 1                 successThreshold: 1               failureThreshold: 3        
 
  |