使用 istio-gateway 设置 GKE 时的健康检查问题



>Goal

我正在尝试设置一个

Cloud LB -> GKE [istio-gateway -> my-service]

这在以前是有效的,但是,我必须在 2 天前重新创建集群并遇到此问题。也许一些版本更改?

这是我的入口清单文件

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "my-dev-ingress"
namespace: "istio-system"
annotations:
kubernetes.io/ingress.global-static-ip-name: "my-dev-gclb-ip"
ingress.gcp.kubernetes.io/pre-shared-cert: "my-dev-cluster-cert-05"
kubernetes.io/ingress.allow-http: "false"
spec:
backend:
serviceName: "istio-ingressgateway"
servicePort: 80

问题

云LB的健康检查问题失败。入口创建的后端服务创建/:80 默认运行状况检查。

我试过什么

1( 我尝试将 gke 入口生成的健康检查设置为指向后端配置控制台中的 istio 网关 StatusPort 端口 15020。然后,运行状况检查会传递一段时间,直到后端配置恢复为使用它创建的原始/:80 运行状况检查。我什至尝试删除它创建的运行状况检查,它只是创建了另一个。

2(我还尝试使用istio-virtual服务将运行状况检查路由到15020端口,如图所示,但取得了很大的成功。

3(我还尝试在虚拟服务运行状况检查端口中路由所有内容

hosts:
- "*"
gateways:
- my-web-gateway
http:
- match:
- method:
exact: GET
uri:
exact: /
route:
- destination:
host: istio-ingress.gke-system.svc.cluster.local
port:
number: 15020

4(我找到的大多数搜索结果都说,在部署中设置readinessProbe应该告诉入口设置正确的运行状况检查。但是,我的所有服务都在 istio 网关下,我真的不能做同样的事情。

我现在很迷茫,如果有人能指出我正确的方向,我将不胜感激。谢谢

我得到了它与 gke 1.20.4-gke.2200 和 istio 1.9.2 一起工作,这方面的文档不存在,或者我没有找到任何东西,您必须向 istio-Ingressgateway 服务添加一个注释,以便在使用"istioctl install -f values.yaml"命令时使用后端配置

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
components:
ingressGateways:
- name: istio-ingressgateway
enabled: true
k8s:
serviceAnnotations:
cloud.google.com/backend-config: '{"default": "istio-ingressgateway-config"}'

然后,您必须使用正确的运行状况检查端口创建后端配置

apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: istio-ingressgateway-config
namespace: istio-system
spec:
healthCheck:
checkIntervalSec: 30
port: 15021
type: HTTP
requestPath: /healthz/ready

这样,入口应该会自动更改指向 Istio 端口 80 的负载均衡器运行状况检查的配置

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web
namespace: istio-system
annotations:
kubernetes.io/ingress.global-static-ip-name: web
networking.gke.io/managed-certificates: "web"
spec:
rules:
- host: test.example.com
http:
paths:
- path: "/*"
pathType: Prefix
backend:
service:
name: istio-ingressgateway
port:
number: 80
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: direct-web
namespace: istio-system
spec:
hosts:
- test.example.com
gateways:
- web
http:
- match:
- uri:
prefix: "/"
route:
- destination:
port:
number: 8080 #internal service port
host: "internal-service.service-namespace.svc.cluster.local"
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: web
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- test.example.com

您还可以在虚拟服务和网关中将主机设置为"*">

最新更新