Complete the code to create a VirtualService that routes all traffic to the 'v1' version of the service.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-service
spec:
hosts:
- my-service
http:
- route:
- destination:
host: my-service
subset: [1]The subset 'v1' directs traffic to version 1 of the service as defined in DestinationRule.
Complete the code to define a DestinationRule that sets the subset 'v2' with the label 'version: v2'.
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: my-service
spec:
host: my-service
subsets:
- name: v2
labels:
[1]: v2The label key 'version' is used to define subsets for traffic routing in Istio.
Fix the error in the VirtualService to split traffic 80% to 'v1' and 20% to 'v2'.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-service
spec:
hosts:
- my-service
http:
- route:
- destination:
host: my-service
subset: v1
weight: [1]
- destination:
host: my-service
subset: v2
weight: 20The weight for 'v1' should be 80 to split traffic 80% to 'v1' and 20% to 'v2'.
Fill both blanks to create a Gateway that listens on port 80 for HTTP traffic.
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: my-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: [1]
name: http
protocol: [2]
hosts:
- "*"The Gateway listens on port 80 with protocol HTTP for incoming web traffic.
Fill all three blanks to create a VirtualService that uses the Gateway 'my-gateway' and routes traffic to subset 'v1' of 'my-service'.
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: my-service spec: hosts: - my-service gateways: - [1] http: - route: - destination: host: [2] subset: [3]
The VirtualService uses the Gateway named 'my-gateway', routes to host 'my-service' and subset 'v1'.