Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes readinessProbe失败时销毁未就绪pod_Kubernetes - Fatal编程技术网

Kubernetes readinessProbe失败时销毁未就绪pod

Kubernetes readinessProbe失败时销毁未就绪pod,kubernetes,Kubernetes,我正在尝试部署一个包含健康检查端点的应用程序。如果失败,pod应被销毁,但K8s保持pod处于运行状态 配置: readinessProbe: httpGet: path: /healthcheck port: 3001 initialDelaySeconds: 5 periodSeconds: 5 successThreshold: 1 吊舱: 因此,有一种方法可以在就绪探测失败

我正在尝试部署一个包含健康检查端点的应用程序。如果失败,pod应被销毁,但K8s保持pod处于运行状态

配置:

     readinessProbe:
        httpGet:
          path: /healthcheck
          port: 3001
        initialDelaySeconds: 5
        periodSeconds: 5
        successThreshold: 1
吊舱:


因此,有一种方法可以在就绪探测失败时摧毁pod?

这不是探测的目的。LivenessProbe在出现故障时,重试配置次数后将“重启”pod。相反,ReadinessProbe有助于指示pod在故障期间不应服务于流量。如果您需要编写一个插件来监控pod状态,并在出现故障时删除复制副本或部署,那么探测器并不意味着运行或中止pod

将其与活动性配对以使其更有效并指定资源限制

    resources:
      limits:
        cpu: 300m
        memory: 200Mi
      requests:
        cpu: 300m
        memory: 200Mi  
    readinessProbe:
      httpGet:
        path: /api/health
        port: 80
      initialDelaySeconds: 15
      periodSeconds: 20
      successThreshold: 1
      failureThreshold: 3
    livenessProbe:
      httpGet:
        path: /api/health
        port: 80
      initialDelaySeconds: 25
      periodSeconds: 25
      successThreshold: 1
      failureThreshold: 3    

准备就绪探测器用于服务准备就绪(如果它通过了,那么你在负载平衡器中,如果它没有通过,那么你没有),它用于切断过载pod的通信,并让它刷新其背面预压力

Liveness探测器用于杀死不健康的豆荚,没有恢复的希望

文件非常清楚:

    resources:
      limits:
        cpu: 300m
        memory: 200Mi
      requests:
        cpu: 300m
        memory: 200Mi  
    readinessProbe:
      httpGet:
        path: /api/health
        port: 80
      initialDelaySeconds: 15
      periodSeconds: 20
      successThreshold: 1
      failureThreshold: 3
    livenessProbe:
      httpGet:
        path: /api/health
        port: 80
      initialDelaySeconds: 25
      periodSeconds: 25
      successThreshold: 1
      failureThreshold: 3