问题描述
任何大于或等于 200 且小于 400 的代码表示 成功。任何其他代码都表示失败。
所以如果容器为探测返回 301
,则探测应该成功。但我有一个容器,但情况并非如此。使用 CURL 我得到 301
,但探测失败并显示 503
。重定向的目标不可用。
在 Openshift 3.11 中使用以下探针进行测试:
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- name: 'redirect'
image: ngingx
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
解决方法
此话题已在 Github 中提出 - kubelet's httpProbe follow redirects
根据 this comment 中的 @thockin
测试,当前的 probes
配置允许 HTTP probes
重定向及其当前行为。
c) 修复文档并跟随重定向(当前行为)
我检查了变更日志,但这种行为没有改变。
此外,当响应为 301
时,您可以检查具有类似问题的 this thread。