云容器实例 CCI-业务探针(Readiness probe):Readiness Probe高级配置

时间:2023-12-21 21:07:00

Readiness Probe高级配置

与Liveness Probe相同,Readiness Probe也有同样的高级配置选项,上面nginx Pod的describe命令回显有中有如下行。

Readiness: exec [ls /var/ready] delay=0s timeout=1s period=10s #success=1 #failure=3

这一行表示readiness probe的具体参数配置,其含义如下:

  • delay=0s 表示容器启动后立即开始探测,没有延迟时间
  • timeout=1s 表示容器必须在1s内做出相应反馈给probe,否则视为探测失败
  • period=10s 表示每10s探测一次
  • #success=1 表示探测连续1次成功表示成功
  • #failure=3 表示探测连续3次失败后会重启容器

这些是创建时默认设置的,您也可以手动配置,如下所示。

        readinessProbe:      # Readiness Probe
          exec:              # 定义 ls /readiness/ready 命令
            command:
            - ls
            - /readiness/ready
          initialDelaySeconds: 10    # 容器启动后多久开始探测
          timeoutSeconds: 2          # 表示容器必须在2s内做出相应反馈给probe,否则视为探测失败
          periodSeconds: 30          # 探测周期,每30s探测一次
          successThreshold: 1        # 连续探测1次成功表示成功
          failureThreshold: 3        # 连续探测3次失败表示失败
support.huaweicloud.com/devg-cci/cci_05_0026.html