0
0
Kubernetesdevops~10 mins

Traffic management with Istio in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a VirtualService that routes all traffic to the 'v1' version of the service.

Kubernetes
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-service
spec:
  hosts:
  - my-service
  http:
  - route:
    - destination:
        host: my-service
        subset: [1]
Drag options to blanks, or click blank then click option'
Av1
Bv2
Cv3
Dlatest
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a version that is not defined in the DestinationRule
Using 'latest' which is not a valid subset
2fill in blank
medium

Complete the code to define a DestinationRule that sets the subset 'v2' with the label 'version: v2'.

Kubernetes
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: my-service
spec:
  host: my-service
  subsets:
  - name: v2
    labels:
      [1]: v2
Drag options to blanks, or click blank then click option'
Aapp
Bversion
Cenv
Dtier
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'app' or 'env' which are not used for version subsets
Leaving the label key empty
3fill in blank
hard

Fix the error in the VirtualService to split traffic 80% to 'v1' and 20% to 'v2'.

Kubernetes
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: 20
Drag options to blanks, or click blank then click option'
A20
B50
C80
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Setting weight to 20 which duplicates 'v2' weight
Setting weight to 100 which sends all traffic to 'v1'
4fill in blank
hard

Fill both blanks to create a Gateway that listens on port 80 for HTTP traffic.

Kubernetes
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: [1]
      name: http
      protocol: [2]
    hosts:
    - "*"
Drag options to blanks, or click blank then click option'
A80
B443
CHTTP
DHTTPS
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 443 which is for HTTPS
Using protocol 'HTTPS' when port is 80
5fill in blank
hard

Fill all three blanks to create a VirtualService that uses the Gateway 'my-gateway' and routes traffic to subset 'v1' of 'my-service'.

Kubernetes
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-service
spec:
  hosts:
  - my-service
  gateways:
  - [1]
  http:
  - route:
    - destination:
        host: [2]
        subset: [3]
Drag options to blanks, or click blank then click option'
Amy-gateway
Bmy-service
Cv1
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' as subset which is not defined
Using wrong gateway or host names