我正在尝试设置
Cloud LB -> GKE [istio-gateway -> my-service]
这是可行的,但是,我必须在两天前重新创建集群并遇到此问题。也许会有一些版本更改?
这是我的入口清单文件
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
Cloud LB的运行状况检查问题失败。 Ingress创建的后端服务会创建/:80默认运行状况检查。
1)我试图将gke入口生成的运行状况检查设置为指向后端配置控制台中的istio-gateway StatusPort端口15020。然后,运行状况检查通过了一段时间,直到后端配置恢复为使用其创建的原始/:80运行状况检查。我什至试图删除它创建的运行状况检查,而只是创建了另一个。
2)我还尝试使用组织虚拟服务将运行状况检查路由到here所示的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网关下,我不能真正做到这一点。
我现在很迷失,如果有人能指出我正确的方向,我将非常感谢。谢谢
答案 0 :(得分:0)
我让它与 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
您也可以在虚拟服务和网关中将主机设置为“*”