Created
May 9, 2020 03:51
-
-
Save nashmaniac/a90765be8732555cc1fbc3e792d9bac1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.istio.io/v1alpha3 | |
kind: VirtualService | |
metadata: | |
name: user-virtual-service #self explanatory | |
namespace: traffic-management #self explanatory | |
spec: | |
hosts: # a virtual service can redirect requests for multiple hosts. this is more of a filtering hosts | |
- user.traffic-management.retailvoice.xyz | |
gateways: # a virtual service can also received requests from multiple gateway | |
- traffic-management/ingressgateway # always safe to access with namespaces | |
http: | |
# it actually saying when I get any requests for user.microservice.retailvoice.xyz, | |
# just redirect it to user-service.traffic-management.svc.cluster.local on port 8000 | |
# if only one port configuration present in user-service.traffic-management.svc.cluster.local then | |
# you can omit the port configuration portion | |
- match: | |
- headers: | |
mode: # custom name of header. anything you like can be given | |
exact: dev # I am trying exact match. other options are prefix, suffix | |
route: | |
- destination: | |
host: user-service.traffic-management.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 | |
subset: version2 | |
- route: | |
- destination: | |
host: user-service.traffic-management.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 | |
subset: version1 | |
--- | |
apiVersion: networking.istio.io/v1alpha3 | |
kind: DestinationRule | |
metadata: | |
name: user-destination-rule #self explanatory | |
namespace: traffic-management #self explanatory | |
spec: | |
host: user-service.traffic-management.svc.cluster.local # for which incoming service it will be triggered. | |
subsets: | |
- name: version1 # custom name | |
labels: | |
version: v1 # version label we used in our deployment | |
- name: version2 # custom name | |
labels: | |
version: v2 # version label we used in our deployment | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment