Istio Virtual Service match uri and cookie not working

4/25/2019

I have been trying to apply this virtual service yaml for my microservices:

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

Using the code block above, after curl-ing the uri, there is not traffic going into the pod.

If I comment out the information as shown in the code block below:

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

The traffic is directed to the pod, which can be shown in the image below: enter image description here

Postman setting as below: enter image description here

-- Joe. L
istio
kubernetes
microservices
networking

0 Answers