Warning: Array to string conversion in /home/wwwroot/myf5/wp-content/plugins/wpjam-basic/public/wpjam-utils.php on line 496
下发如下virtualservice策略,header中包含end-user:jason的请求发reviews的v2版本,其它的请求 50%发往v1,50%发往v2
[root@k8s-master-v1-16 networking]# cat virtual-service-reviews-jason-weight-istio-bookinfo.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
namespace: istio-bookinfo
spec:
hosts:
- reviews
http:
- match:
- headers:
end-user:
exact: jason
route:
- destination:
host: reviews
subset: v2
- route:
- destination:
host: reviews
subset: v1
weight: 50
- destination:
host: reviews
subset: v3
weight: 50
$ istioctl proxy-config route productpage-v1-7f4cc988c6-qxqjs.istio-bookinfo --name 9080 -o json | grep -A 100 '"name": "reviews.istio-bookinfo.svc.cluster.local:9080",'
"name": "reviews.istio-bookinfo.svc.cluster.local:9080",
"domains": [
"reviews.istio-bookinfo.svc.cluster.local",
"reviews.istio-bookinfo.svc.cluster.local:9080",
"reviews",
"reviews:9080",
"reviews.istio-bookinfo.svc.cluster",
"reviews.istio-bookinfo.svc.cluster:9080",
"reviews.istio-bookinfo.svc",
"reviews.istio-bookinfo.svc:9080",
"reviews.istio-bookinfo",
"reviews.istio-bookinfo:9080",
"10.105.236.72",
"10.105.236.72:9080"
],
"routes": [
{
"match": {
"prefix": "/",
"caseSensitive": true,
"headers": [
{
"name": "end-user",
"exactMatch": "jason"
}
]
},
"route": {
"cluster": "outbound|9080|v2|reviews.istio-bookinfo.svc.cluster.local",
"timeout": "0s",
"retryPolicy": {
"retryOn": "connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes",
"numRetries": 2,
"retryHostPredicate": [
{
"name": "envoy.retry_host_predicates.previous_hosts"
}
],
"hostSelectionRetryMaxAttempts": "5",
"retriableStatusCodes": [
503
]
},
"maxGrpcTimeout": "0s"
},
"metadata": {
"filterMetadata": {
"istio": {
"config": "/apis/networking.istio.io/v1alpha3/namespaces/istio-bookinfo/virtual-service/reviews"
}
}
},
"decorator": {
"operation": "reviews.istio-bookinfo.svc.cluster.local:9080/*"
}
},
{
"match": {
"prefix": "/"
},
"route": {
"weightedClusters": {
"clusters": [
{
"name": "outbound|9080|v1|reviews.istio-bookinfo.svc.cluster.local",
"weight": 50
},
{
"name": "outbound|9080|v3|reviews.istio-bookinfo.svc.cluster.local",
"weight": 50
}
]
},
"timeout": "0s",
"retryPolicy": {
"retryOn": "connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes",
"numRetries": 2,
"retryHostPredicate": [
{
"name": "envoy.retry_host_predicates.previous_hosts"
}
],
"hostSelectionRetryMaxAttempts": "5",
"retriableStatusCodes": [
503
]
},
"maxGrpcTimeout": "0s"
},
"metadata": {
"filterMetadata": {
"istio": {
"config": "/apis/networking.istio.io/v1alpha3/namespaces/istio-bookinfo/virtual-service/reviews"
}
}
},
"decorator": {
"operation": "reviews:9080/*"
}
}
],
Array
文章评论