Answer a question

How can I configure Istio VirtualService to route traffic to a destination backend that listens on HTTPS?

configuring protocol: HTTPS or scheme: HTTPS didn't work.

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

Here is my gateway:

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"

Answers

Have you got a destination rule setup also, as an example:

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: dr-test.example.com
spec:
  host: test.example.com
  trafficPolicy: # Apply to all ports
    portLevelSettings:
    - port:
        number: 443
      loadBalancer:
        simple: LEAST_CONN

some good information on istio routing

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐