活跃性和就绪性探针连接被拒绝 [英] Liveness and readiness probe connection refused

查看:362
本文介绍了活跃性和就绪性探针连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试设置活动性&时,我一直收到此错误.我的awx_web容器的准备就绪概率

I keep getting this error when I try to setup liveness & readiness prob for my awx_web container

Liveness probe failed: Get http://POD_IP:8052/: dial tcp POD_IP:8052: connect: connection refused

活力与在我的部署中,容器awx_web的就绪"部分

Liveness & Readiness section in my deployment for the container awx_web

          ports:
          - name: http
            containerPort: 8052 # the port of the container awx_web
            protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: 8052
            initialDelaySeconds: 5
            periodSeconds: 5
          readinessProbe:
            httpGet:
              path: /
              port: 8052
            initialDelaySeconds: 5
            periodSeconds: 5

如果我测试端口8052是否从与包含容器awx_web的容器相同的名称空间中的另一个容器打开,或者是否使用与容器awx_web相同的容器中部署的容器进行测试,我会收到此提示(端口是开放的)

if I test if the port 8052 is open or not from another pod in the same namespace as the pod that contains the container awx_web or if I test using a container deployed in the same pod as the container awx_web i get this (port is open)

/ # nc -vz POD_IP 8052
POD_IP  (POD_IP :8052) open

如果我从部署了包含容器awx_web的pod的工作程序节点上使用netcat(nc),则会得到相同的结果(端口8052打开).

I get the same result (port 8052 is open) if I use netcat (nc) from the worker node where pod containing the container awx_web is deployed.

有关信息,我使用NodePort服务将流量重定向到该容器(awx_web)

for info I use a NodePort service that redirect traffic to that container (awx_web)

type: NodePort
ports:
- name: http
  port: 80
  targetPort: 8052
  nodePort: 30100

推荐答案

我重新创建了您的问题,看来您的问题是由于活动性探针的initialDelaySeconds值太小引起的.

I recreated your issue and it looks like your problem is caused by too small value of initialDelaySeconds for the liveness probe.

awx容器打开8052端口需要5秒钟以上的时间. 您需要等待更长的时间才能启动.我发现将它设置为15s就足够了,但是您可能需要进行一些调整.

It takes more than 5s for awx container to open 8052 port. You need to wait a bit longer for it to start. I have found out that setting it to 15s is enough for me, but you may require some tweaking.

这篇关于活跃性和就绪性探针连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆