Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/344.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.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
Java Liveness probe失败,但可以从不同的POD访问终结点_Java_Spring Boot_Kubernetes_Kubernetes Helm_Livenessprobe - Fatal编程技术网

Java Liveness probe失败,但可以从不同的POD访问终结点

Java Liveness probe失败,但可以从不同的POD访问终结点,java,spring-boot,kubernetes,kubernetes-helm,livenessprobe,Java,Spring Boot,Kubernetes,Kubernetes Helm,Livenessprobe,我正在尝试在我的helm chart部署模板中实现一个简单的活动性探测。下面是我的活动探测器配置。弹簧启动/exactor/health端点用作健康检查端点 containers: - name: {{ .Release.Name }}-container image: {{ .Values.container.image }} ports: - containerPort: 8080 liven

我正在尝试在我的helm chart部署模板中实现一个简单的活动性探测。下面是我的活动探测器配置。弹簧启动
/exactor/health
端点用作健康检查端点

containers:
        - name: {{ .Release.Name }}-container
          image: {{ .Values.container.image }}
          ports:
            - containerPort: 8080
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: 8080
            failureThreshold: 5
            periodSeconds: 10
            initialDelaySeconds: 30
            timeoutSeconds: 25
这就是我遇到的错误(尝试添加较大的initialDelay,也尝试添加startupProbe。两者都不起作用)

但是,我能够通过这个端点从不同的POD获得200个响应,这些POD位于相同的ec2实例和不同的ec2实例中

$k exec -it pod/test sh
# curl http://x.x.x.x:8080/actuator/health  -I
HTTP/1.1 200 OK
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type: application/vnd.spring-boot.actuator.v3+json
correlation-id: x-x-x-x-x
Date: Fri, 09 Oct 2020 14:04:56 GMT
没有liveness探测器,应用程序工作正常,我可以通过端口8080访问所有端点

尝试将livenessprobe设置到nginx映像,效果良好(因此排除了网络问题)

容器:
活力:
容器ID:docker://0af63462845d6a2b44490308147c73277d22aff56f993ca7c065a495ff97fcfa
图片:nginx
图像ID:docker-pullable://nginx@sha256:c628b67d21744fce822d22fdcc0389f6bd763daac23a6b77147d0712ea7102d0
端口:80/TCP
主机端口:0/TCP
状态:正在运行
开始时间:2020年9月29日星期二15:53:17+0530
准备好了吗
重新启动计数:0
活跃度:http get http://:80/延迟=2s超时=1s周期=2s#成功=1#失败=3
环境:
挂载:
/来自default-token-57smz(ro)的var/run/secrets/kubernetes.io/serviceCount

回复需要多长时间?你试过增加
timeoutSeconds
的值吗?@Bimal是的,我试过将timeoutSeconds增加到一个很大的数字,但仍然没有成功
$k exec -it pod/test sh
# curl http://x.x.x.x:8080/actuator/health  -I
HTTP/1.1 200 OK
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type: application/vnd.spring-boot.actuator.v3+json
correlation-id: x-x-x-x-x
Date: Fri, 09 Oct 2020 14:04:56 GMT
Containers:
  liveness:
    Container ID:   docker://0af63462845d6a2b44490308147c73277d22aff56f993ca7c065a495ff97fcfa
    Image:          nginx
    Image ID:       docker-pullable://nginx@sha256:c628b67d21744fce822d22fdcc0389f6bd763daac23a6b77147d0712ea7102d0
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Tue, 29 Sep 2020 15:53:17 +0530
    Ready:          True
    Restart Count:  0
    Liveness:       http-get http://:80/ delay=2s timeout=1s period=2s #success=1 #failure=3
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-57smz (ro)