Skip to content

Instantly share code, notes, and snippets.

@nashmaniac
Created May 2, 2020 08:50
Show Gist options
  • Save nashmaniac/71304fe4676f6039e866e391ab9e6caf to your computer and use it in GitHub Desktop.
Save nashmaniac/71304fe4676f6039e866e391ab9e6caf to your computer and use it in GitHub Desktop.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: user-virtual-service #self explanatory
namespace: default #self explanatory
spec:
hosts: # a virtual service can redirect requests for multiple hosts. this is more of a filtering hosts
- user.microservice.retailvoice.xyz
gateways: # a virtual service can also received requests from multiple gateway
- ingressgateway
http:
# it actually saying when I get any requests for user.microservice.retailvoice.xyz,
# just redirect it to user-service.default.svc.cluster.local on port 8000
# if only one port configuration present in user-service.default.svc.cluster.local then
# you can omit the port configuration portion
- route:
- destination:
host: user-service.default.svc.cluster.local # this format is safe. But if virtual service and cluster ip service are in same namespace only service name user-service would be enough
port:
number: 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment