将 K8s Ingress 与 Istio 网关一起使用?
Use K8s Ingress with Istio gateway?
在 helm 值文件中有一个带有描述的设置 global.k8sIngressSelector。
Gateway used for legacy k8s Ingress resources. By default it is
using 'istio:ingress', to match 0.8 config. It requires that
ingress.enabled is set to true. You can also set it
to ingressgateway, or any other gateway you define in the 'gateway'
section.
我对此的解释是,istio ingress 应该采用正常的 ingress 配置,而不是必须创建虚拟服务。这个对吗?我试过了,但它对我不起作用。
kind: Deployment
apiVersion: apps/v1
metadata:
name: echo
spec:
replicas: 1
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- name: echo
image: mendhak/http-https-echo
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: echo
spec:
type: ClusterIP
selector:
app: echo
ports:
- port: 80
name: http
这有效
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- '*.dev.example.com'
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: echo
spec:
hosts:
- echo.dev.example.com
gateways:
- gateway
http:
- route:
- destination:
host: echo
这不是
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: echo
spec:
rules:
- host: echo.dev.example.com
http:
paths:
- backend:
serviceName: echo
servicePort: 80
您的 Ingress 需要注释:kubernetes.io/ingress.class: istio
.
根据您使用的 Istio 版本,它可能无法正常工作。目前有一个未解决的问题,关于 Ingress 在最新的驱动程序中不工作,听起来它可能已经坏了一段时间。
在 helm 值文件中有一个带有描述的设置 global.k8sIngressSelector。
Gateway used for legacy k8s Ingress resources. By default it is using 'istio:ingress', to match 0.8 config. It requires that ingress.enabled is set to true. You can also set it to ingressgateway, or any other gateway you define in the 'gateway' section.
我对此的解释是,istio ingress 应该采用正常的 ingress 配置,而不是必须创建虚拟服务。这个对吗?我试过了,但它对我不起作用。
kind: Deployment
apiVersion: apps/v1
metadata:
name: echo
spec:
replicas: 1
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- name: echo
image: mendhak/http-https-echo
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: echo
spec:
type: ClusterIP
selector:
app: echo
ports:
- port: 80
name: http
这有效
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- '*.dev.example.com'
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: echo
spec:
hosts:
- echo.dev.example.com
gateways:
- gateway
http:
- route:
- destination:
host: echo
这不是
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: echo
spec:
rules:
- host: echo.dev.example.com
http:
paths:
- backend:
serviceName: echo
servicePort: 80
您的 Ingress 需要注释:kubernetes.io/ingress.class: istio
.
根据您使用的 Istio 版本,它可能无法正常工作。目前有一个未解决的问题,关于 Ingress 在最新的驱动程序中不工作,听起来它可能已经坏了一段时间。