Created
May 9, 2020 02:09
-
-
Save nashmaniac/1dd43ec81e1d92c798003e5dc6f2e791 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 | |
- 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 | |
weight: 90 | |
- 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 | |
weight: 10 | |
--- | |
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 | |
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