【发布时间】:2019-09-14 13:41:37
【问题描述】:
我一直在尝试将此虚拟服务 yaml 应用于我的微服务:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: nameko-notifyms
spec:
hosts:
- "*"
gateways:
- nameko-notifyms-gateway
http:
- match:
- headers:
cookie:
regex: "^(.*?;)?(user=joe)(;.*)?"
uri:
exact: /hello
route:
- destination:
host: nameko-notifyms
port:
number: 8000
使用上面的代码块,在 curl uri 之后,没有流量进入 pod。
如果我注释掉如下代码块所示的信息:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: nameko-notifyms
spec:
hosts:
- "*"
gateways:
- nameko-notifyms-gateway
http:
- match:
# - headers:
# cookie:
# regex: "^(.*?;)?(user=joe)(;.*)?"
- uri:
exact: /hello
route:
- destination:
host: nameko-notifyms
port:
number: 8000
【问题讨论】:
-
你用什么卷曲做测试?
-
@VasilyAngapov 我实际上正在使用 Postman,将在我的 cookie 中添加屏幕截图。
-
可能
regex字符串有误,试试看:^(.*?;)?(user=joe)(;.*)?$。
标签: networking kubernetes microservices istio