活动性探针失败,但是可以从不同的容器访问端点

时间:2020-10-09 14:34:11

标签: java spring-boot kubernetes kubernetes-helm livenessprobe

我正在尝试在舵图部署模板中实现一个简单的活动性探针。以下是我的活动探针配置。春季启动/actuator/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。两者均无效)

Liveness probe failed: Get http://x.x.x.x:8080/actuator/health: dial tcp x.x.x.x:8080: connect: connection refused

但是,我能够通过此端点从处于相同ec2实例和不同ec2实例中的不同容器获得200个响应。

$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

没有活动度探针,该应用程序运行正常,我可以通过端口8080访问所有端点。

尝试为nginx图像设置livenessprobe,并且效果很好(因此排除了网络问题)

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)

0 个答案:

没有答案