0

In the process of testing out Istio I'm in need of rewriting all incomming requests on the Istio ingress controller in the same manner as with Kubernetes's own ingress controller, where I use the rewrite-target annotation.

# Existing Kubernetes ingress configuration
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: api
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:    
  rules:
  - host: some.host.com
    http:
      paths:
      - path: /svc
        backend:
          serviceName: svc
          servicePort: 80

This makes all requests, e.g. http://some.host.com/svc/endpoint hit the service with /endpoint instead of /svc/endpoint

How can I effectively do the same with Istio's ingress controller?

The Route rules object can handle rewrites, but is only available as a per destination manner, i.e. I have to create a route rule for every service.

4

1 回答 1

2

你说的对。您需要每个服务的路由规则来设置重写目标。有关示例,请参见https://istio.io/docs/reference/config/traffic-rules/routing-rules.html#httprewrite 。

于 2017-06-02T18:15:00.337 回答