istio virtual host and destination rule basics
In Istio we need virtual service and destination rule to route our traffic to the right service.
What is the bare minimum correct configuration that is needed to do this?
1. VirtualService.spec.hosts = DestinationRule.spec.host - this host must be exactly the same, for example if there is a host for "server-a.example.com" in virtual service, then the destination rule host must have "server-a.example.com".
2. Subset if exist - needs to exist in both virtual service and destination rule.
A minimal configuration would look like this:-
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: reviews-destination
spec:
host: reviews # MUST match VirtualService hosts
subsets:
- name: v1
labels:
version: v1
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: reviews
spec:
gateways:
- shared-gateway.gateway-system.svc.cluster.local # MUST match Gateway name and namespace
hosts:
- reviews # MUST match DestinationRule host
http:
- route:
- destination:
host: reviews
subset: v1 # MUST match DestinationRule subset
Comments