Ama*_*Rai 6 google-compute-engine kubernetes google-kubernetes-engine kubernetes-health-check
创建GCE入口时,Google Load Balancer不会通过“就绪”探针设置运行状况检查。根据文档(Ingress GCE运行状况检查),应该将其选中。
公开任意URL作为对支持该服务的pod的准备情况调查。
有什么想法吗?
部署:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: frontend-prod
labels:
app: frontend-prod
spec:
selector:
matchLabels:
app: frontend-prod
replicas: 3
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: frontend-prod
spec:
imagePullSecrets:
- name: regcred
containers:
- image: app:latest
readinessProbe:
httpGet:
path: /healthcheck
port: 3000
initialDelaySeconds: 15
periodSeconds: 5
name: frontend-prod-app
- env:
- name: PASSWORD_PROTECT
value: "1"
image: nginx:latest
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 5
periodSeconds: 5
name: frontend-prod-nginx
Run Code Online (Sandbox Code Playgroud)
服务:
apiVersion: v1
kind: Service
metadata:
name: frontend-prod
labels:
app: frontend-prod
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: frontend-prod
Run Code Online (Sandbox Code Playgroud)
入口:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: frontend-prod-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: frontend-prod-ip
spec:
tls:
- secretName: testsecret
backend:
serviceName: frontend-prod
servicePort: 80
Run Code Online (Sandbox Code Playgroud)
因此,显然,您需要在PodSpec上包含容器端口。似乎没有记录在任何地方。
例如
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
Run Code Online (Sandbox Code Playgroud)
谢谢布莱恩!https://github.com/kubernetes/ingress-gce/issues/241
\n\n\n下面由Jonathan Lin更新:这个问题最近已经修复。定义
\nreadinessProbe上的Deployment. 重新创建您的Ingress. 它将从 中获取健康检查路径readinessProbe。
GKE Ingress 运行状况检查路径当前不可配置。您可以访问http://console.cloud.google.com (UI) and visit Load Balancers list to see the health check it uses.
\n\n目前,Ingress 的健康检查是在 Ingress 上指定的GET /每个上进行的。backend:因此,GKE Ingress 后面的所有应用程序都必须返回 HTTP 200 OKGET / requests.
也就是说,kubelet 仍在使用您在 Pod 上指定的运行状况检查 \xe2\x80\x93\xe2\x80\x93,以确保您的 Pod 确实正常运行且健康。
\n现在最新的 GKE 中可以实现这一点(我正在使用1.14.10-gke.27,不确定这是否重要)
readinessProbe在部署中的容器上定义 a 。readinessProbe.httpGet.path部署 yaml 配置中的路径。| 归档时间: |
|
| 查看次数: |
3337 次 |
| 最近记录: |