如何配置 Istio VirtualService 将流量路由到侦听 HTTPS 的目标后端?
配置protocol: HTTPS或scheme: HTTPS不起作用。
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: api-rpi-access
spec:
hosts:
- "test.example.com"
gateways:
- api-gateway
http:
- match:
- uri:
port: https
prefix: /
route:
- destination:
host: some-https-service
port:
number: 8443
protocol: HTTPS
# scheme: HTTPS
Run Code Online (Sandbox Code Playgroud)
这是我的网关:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: api-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 443
name: https
protocol: HTTPS
tls:
mode: SIMPLE
serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
privateKey: /etc/istio/ingressgateway-certs/tls.key
hosts:
- "test.example.com"
Run Code Online (Sandbox Code Playgroud)
为了在 istio-ingressgateway 上执行 TLS 终止并将 https 流量发送到后端,我必须添加以下内容DestinationRule
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: some-https-service
spec:
host: diary
trafficPolicy:
tls:
mode: SIMPLE
Run Code Online (Sandbox Code Playgroud)
Gateway这是和的 yaml VirtualService:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: api-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 443
name: https
protocol: HTTPS
tls:
mode: SIMPLE
serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
privateKey: /etc/istio/ingressgateway-certs/tls.key
hosts:
- "test.example.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ext-access
spec:
hosts:
- "test.example.com"
gateways:
- api-gateway
http:
- match:
- uri:
port: https
prefix: /
route:
- destination:
host: some-https-service
port:
number: 8443
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13120 次 |
| 最近记录: |