Kubernetes 集群中的 Liveness 和 Readiness 探测失败 - 在应用程序中启用了 istio 代理 sidecar 注入

问题描述

以下是我的应用程序舵图中探针的配置

{{- if .Values.endpoint.liveness }}
          livenessProbe:
            httpGet:
              host: localhost
              path: {{ .Values.endpoint.liveness | quote }}
              port: 9080
            initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
            periodSeconds: 5
{{- end }}
{{- if .Values.endpoint.readiness }}
          readinessProbe:
            httpGet:
              host: localhost
              path: {{ .Values.endpoint.readiness | quote }}
              port: 9080
            initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
            periodSeconds: 60
{{- end }}
{{- end }}

当我部署时,在 deployment.yaml 中

livenessProbe:
            httpGet:
              path: /my/app/path/health
              port: 9080
              host: localhost
              scheme: HTTP
            initialDelaySeconds: 8
            timeoutSeconds: 1
            periodSeconds: 5
            successthreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /my/app/path/health
              port: 9080
              host: localhost
              scheme: HTTP
            initialDelaySeconds: 5
            timeoutSeconds: 1
            periodSeconds: 60
            successthreshold: 1
            failureThreshold: 3

但是在 pod.yaml 中是

livenessProbe:
       httpGet:
         path: /app-health/app-name/livez
         port: 15020
         host: localhost
         scheme: HTTP
       initialDelaySeconds: 8
       timeoutSeconds: 1
       periodSeconds: 5
       successthreshold: 1
       failureThreshold: 3
     readinessProbe:
       httpGet:
         path: /app-health/app-name/readyz
         port: 15020
         host: localhost
         scheme: HTTP
       initialDelaySeconds: 5
       timeoutSeconds: 1
       periodSeconds: 60
       successthreshold: 1
       failureThreshold: 3

然后在 pod 中给出以下错误

`Readiness probe Failed: Get http://IP:15021/healthz/ready: dial tcp IP:15021: connect: connection denied spec.containers{istio-proxy}

警告 活性探测失败:获取 http://localhost:15020/app-health/app-name/livez: dial tcp 127.0.0.1:15020: connect: connection denied spec.containers{app-name}

警告 就绪探测失败:获取 http://localhost:15020/app-health/app-name/readyz: dial tcp 127.0.0.1:15020: connect: connection denied spec.containers{app-name} `

为什么 pod 使用不同的路径和端口进行探测,并且未能给出上述错误。 有人可以帮我解决遗漏的问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)