Last active
May 9, 2020 03:43
-
-
Save nashmaniac/be4745b1f3c4dceaac9bf353a58d28d8 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: all | |
--- | |
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. | |
trafficPolicy: | |
loadBalancer: | |
consistentHash: | |
httpHeaderName: "my-header" # the hash will be calculated based on my-header value that will be passed by curl | |
subsets: | |
- name: all # custom name | |
labels: | |
app: user # app label we used in our deployment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment