http - Liveness 和 Readiness 探针连接被拒绝
问题描述
当我尝试为我的 awx_web 容器设置 liveness & readiness prob 时,我不断收到此错误
Liveness probe failed: Get http://POD_IP:8052/: dial tcp POD_IP:8052: connect: connection refused
我的容器 awx_web 部署中的 Liveness & Readiness 部分
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 的 pod 位于同一命名空间中的另一个 pod 中打开,或者如果我使用与容器 awx_web 部署在同一 pod 中的容器进行测试,我会得到这个(端口已打开)
/ # nc -vz POD_IP 8052
POD_IP (POD_IP :8052) open
如果我从部署包含容器 awx_web 的 pod 的工作节点使用 netcat (nc),我会得到相同的结果(端口 8052 已打开)。
有关信息,我使用 NodePort 服务将流量重定向到该容器(awx_web)
type: NodePort
ports:
- name: http
port: 80
targetPort: 8052
nodePort: 30100
解决方案
我重新创建了您的问题,看起来您的问题是由initialDelaySeconds
liveness probe 的值太小引起的。
awx 容器打开 8052 端口需要 5s 以上。您需要稍等片刻才能启动。我发现将其设置为 15 秒对我来说就足够了,但您可能需要进行一些调整。
推荐阅读
- ios - 没有设备,因为活动方案没有目标
- javascript - 您可以将带有 wasm 文件的模块加载到 create-react-app 中吗?
- python - python将图像数组打印为纯零,为什么?
- react-hooks - 如何将 Slate JS 悬停菜单转换为 React Hooks?
- angular - 如何禁用导航动画?
- python - PyCharm:如何在 UML 中为 SQLAlchemy 查看模型依赖关系图
- angular - 使用 ion-datetime 值更改更新 Firestore 文档
- maven - 无法使用 GitHub Packages(测试版)发布 maven 依赖项
- shell - 修改记录参数时出现 REPL 错误
- scala - 将自定义谓词传递给 TableQuery 的过滤器方法