0

I'm trying to set some route rules and I have a problem in the following case. If I send a HTTP request to the port, let's say, 5000 of the service "service-a" I want my route rule to forward the request to the port 5001 of the service "service-b". Is it possible?

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-route
spec:
  hosts:
  - service-a:5000
  - service-a
  - service-a.service:5000
  - service-a.service
  - service-a.service.consul:5000
  - service-a.service.consul
  gateways:
  - my-gateway
  http:
  - match:
    - uri:
        prefix: "/v1/service-a"
    rewrite:
      uri: "/v1/ser-a"
    route:
    - destination:
        port:
          number: 5001
        name: service-b

The gateway was defined as follows:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
spec:
  selector:
    app: my-gatweway-controller
  servers:
  - port:
      number: 5000
      name: http
      protocol: HTTP
    hosts:
    - localhost
  - port:
      number: 5001
      name: http
      protocol: HTTP
    hosts:
    - localhost

The result is an internal error 500 and the request lands on port 5000 instead on 5001. Does anybody know how to solve the problem?

Best regards

Martin

biomartin
  • 87
  • 11

1 Answers1

0

The port rewriting was fixed three days ago by this PR - https://github.com/istio/istio/pull/5543, it should appear in the next release of Istio.

Vadim Eisenberg
  • 3,337
  • 1
  • 18
  • 14