【发布时间】:2018-01-30 12:02:22
【问题描述】:
我在kubectl describe podName 看到这个错误:
9m 2s 118 kubelet, gke-wordpress-default-pool-2e82c1f4-0zpw spec.containers{nginx} Warning Unhealthy Readiness probe failed: Get http://10.24.0.27:80/: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
容器日志(nginx)如下:
10.24.1.1 - - [22/Aug/2017:11:09:51 +0000] "GET / HTTP/1.1" 499 0 "-" "Go-http-client/1.1"
但是,如果我通过 kubectl exec -it podName -c nginx sh 执行到容器中并执行 wget http://localhost,我能够成功获得 HTTP 200 响应。如果我通过 SSH 连接到主机(GCP 计算实例),我也能够成功获得 HTTP 200 响应。
我相信这个问题是在我用 NodePort 服务替换 LoadBalancer 服务后不久发生的。不知道是不是端口冲突?
有问题的服务: wordpress-service.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: wordpress
name: wordpress
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: wordpress
容器是一个 Nginx 容器,在端口 80 上提供内容。
准备就绪探测失败的原因可能是什么?
如果我在我的配置中删除就绪探测:
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 5
一切正常,可以通过 LoadBalancer 服务访问 pod。
【问题讨论】:
标签: kubernetes