K8s健康检查

K8s健康检查

  • HTTP
  • TCP
  • 命令行

HTTP

就绪
ReadinessProbe:spec.template.spec.containers[].readinessProbe
启动
StartupProbe:spec.template.spec.containers[].startupProbe
存活
LivenessProbe:spec.template.spec.containers[].livenessProbe

          startupProbe:
            failureThreshold: 3
            httpGet:
              path: /status
              port: 80
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 5
          livenessProbe:
            failureThreshold: 2
            httpGet:
              path: /status
              port: 80
              scheme: HTTP
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 2
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /status
              port: 80
              scheme: HTTP
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 2

TCP

          startupProbe:
            failureThreshold: 3
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 80
            timeoutSeconds: 2
            initialDelaySeconds: 30
          livenessProbe:
            failureThreshold: 3
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 80
            timeoutSeconds: 2
          readinessProbe:
            failureThreshold: 3
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 80
            timeoutSeconds: 2

命令行

          startupProbe:
            exec:
              command:
                - /bin/grpc_health_probe
                - '-addr=:80'
                - '-connect-timeout=3s'
                - '-rpc-timeout=3s'
            failureThreshold: 3
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 3 
          livenessProbe:
            exec:
              command:
                - /bin/grpc_health_probe
                - '-addr=:80'
                - '-connect-timeout=3s'
                - '-rpc-timeout=3s'
            failureThreshold: 3
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 3
          name: beta-vipmanager-file-grpc
          readinessProbe:
            exec:
              command:
                - /bin/grpc_health_probe
                - '-addr=:80'
                - '-connect-timeout=3s'
                - '-rpc-timeout=3s'
            failureThreshold: 3
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 3

exec方式执行http

# 切换为exec方式是因为 http执行看到过一些isses 通过http接口失败的Bug
          startupProbe:
            exec:
              command:
                - curl
                - '--fail'
                - 'http://localhost:80/status'
            failureThreshold: 3
            initialDelaySeconds: 15
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值