2

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

{{- 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}

警告 Liveness probe failed: Get 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 使用不同的路径和端口进行探测,但未能给出上述错误。有人可以帮我解决缺少的问题吗?

4

1 回答 1

1

您将获得这些不同的路径,因为它们是在 Istio 的控制平面组件中跨网格全局配置的,即 istio-sidecar-injector configmap 这是通过 sidecar 的 webhook 注入实现的。请参阅“istio-sidecar-injector configmap”中的以下属性

sidecarInjectorWebhook.rewriteAppHTTPProbe=true

于 2021-08-16T10:01:12.630 回答