We will see how to control access to a service using denials, attribute or IP-based white/blacklisting:
- Let's test this out first by modifying the reviews virtual service to add a default route to reviews:v3 for all users except for the user jason, who will be directed to review:v2:
# Script : 07-modify-reviews-virtual-service.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- match:
- headers:
end-user:
exact: jason
route:
- destination:
host: reviews
subset: v2
- route:
- destination:
host: reviews
subset: v3
- Modify the reviews virtual service:
$ kubectl -n istio-lab apply -f 07-modify-reviews-virtual-service.yaml
virtualservice.networking.istio.io/reviews configured
If the logged-in user is jason, the ratings...