apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: srv
namespace: default
spec:
hosts:
- srv
http:
- match:
- headers:
x-colorant:
exact:user-v1
route:
- destination:
host: srv
subset: user-v1
- route:
- destination:
host: srv
subset: default
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: srv
namespace: default
spec:
host: srv
subsets:
- name: default
labels:
project_env: default
- name: user-v1
labels:
project_env: user-v1
用法:
部署应用增加 label: project_env:xxx
请求时加header: x-colorant:xxx