Bun*_*dyQ 8 google-compute-engine google-cloud-platform kubernetes google-kubernetes-engine kubernetes-ingress
我正在 Google Kubernetes Engine 上运行一个集群,我目前正在尝试按照以下文档从使用具有外部负载平衡(和 NodePort 服务)的 Ingress 切换到具有容器原生负载平衡(和 ClusterIP 服务)的 Ingress:容器原生负载平衡
为了与我的服务进行通信,我使用了以下入口配置,在使用 NodePort 服务而不是 ClusterIP 时,这些配置过去可以正常工作:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: mw-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: mw-cluster-ip
networking.gke.io/managed-certificates: mw-certificate
kubernetes.io/ingress.allow-http: "false"
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: billing-frontend-service
servicePort: 80
- path: /auth/api/*
backend:
serviceName: auth-service
servicePort: 8083
Run Code Online (Sandbox Code Playgroud)
现在按照文档,我没有使用 readinessProbe 作为容器部署的一部分作为健康检查,而是转而使用 ClusterIP 服务与 BackendConfig 结合使用。对于每个部署,我都使用这样的服务:
apiVersion: v1
kind: Service
metadata:
labels:
app: auth
name: auth-service
namespace: default
annotations:
cloud.google.com/backend-config: '{"default": "auth-hc-config"}'
spec:
type: ClusterIP
selector:
app: auth
ports:
- port: 8083
protocol: TCP
targetPort: 8083
Run Code Online (Sandbox Code Playgroud)
和后端配置:
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: auth-hc-config
spec:
healthCheck:
checkIntervalSec: 10
port: 8083
type: http
requestPath: /auth/health
Run Code Online (Sandbox Code Playgroud)
作为参考,这就是 readinessProbe 以前的样子:
readinessProbe:
failureThreshold: 3
httpGet:
path: /auth/health
port: 8083
scheme: HTTP
periodSeconds: 10
Run Code Online (Sandbox Code Playgroud)
现在到实际问题。我首先部署容器和服务,它们似乎启动得很好。然而,入口似乎没有正确进行健康检查,并在云控制台中显示:
Error during sync: error running backend syncing routine: error ensuring health check: googleapi: Error 400: Invalid value for field 'resource.httpHealthCheck': ''. HTTP healthCheck missing., invalid
Run Code Online (Sandbox Code Playgroud)
集群和节点池都运行 GKE 版本 1.17.6-gke.11,因此cloud.google.com/neg: '{"ingress": true}'不需要注释。我已检查并正确注释了该服务:
Annotations: cloud.google.com/backend-config: {"default": "auth-hc-config"}
cloud.google.com/neg: {"ingress":true}
cloud.google.com/neg-status: {"network_endpoint_groups":{"8083":"k8s1-2078beeb-default-auth-service-8083-16a14039"},"zones":["europe-west3-b"]}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1308 次 |
| 最近记录: |