在测试Istio我'm in need of rewriting all incomming requests on the Istio ingress controller in the same manner as with Kubernetes'自己的入口控制器的过程中,我使用了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
这使得所有请求,例如, http://some.host.com/svc/endpoint
用 /endpoint
而不是 /svc/endpoint
点击服务
我怎样才能有效地对Istio的入口控制器做同样的事情呢?
Route rules对象可以处理重写,但仅作为每种目标方式可用,即我必须为每个服务创建路由规则 .
1 回答
你是对的 . 每个服务需要一个路由规则来设置重写目标 . 有关示例,请参见https://istio.io/docs/reference/config/traffic-rules/routing-rules.html#httprewrite .