您的位置 首页 k8s

livenessProbe 健康检查之httpGet案例

livenessProbe 健康检查之httpGet案例

cat 22-pods-livenessProbe-httGet.yaml

kind: Pod
apiVersion: v1
metadata:
  name: baimei-dashu-httpget-001
  labels:
     apps: myweb
spec:
  volumes:
  - name: data
    emptyDir: {}
  containers:
  - name: linux85-httpget
    image: harbor.baimei.com/baimei-web/nginx:1.25.1-alpine
    volumeMounts:
    - name: data
      mountPath: /usr/share/nginx/html
    # 健康状态检查,周期性检查服务是否存活,检查结果失败,将重启容器。
    livenessProbe:
      # 使用httpGet的方式去做健康检查
      httpGet:
        # 指定访问的端口号
        port: 80
        # 检测指定的访问路径
        path: /index.html
      # 检测服务失败次数的累加值,默认值是3次,最小值是1。当检测服务成功后,该值会被重置!
      failureThreshold: 3
      # 指定多久之后进行健康状态检查,即此时间段内检测服务失败并不会对failureThreshold进行计数。
      # initialDelaySeconds: 65
      initialDelaySeconds: 20
      # 指定探针检测的频率,默认是10s,最小值为1.
      periodSeconds: 1
      # 检测服务成功次数的累加值,默认值为1次,最小值1.
      successThreshold: 1
      # 一次检测周期超时的秒数,默认值是1秒,最小值为1.
      timeoutSeconds: 1

 

kubectl  describe  -f 22-pods-livenessProbe-httGet.yaml

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章