Skip to content

Instantly share code, notes, and snippets.

@directlinks
Created August 13, 2020 19:29
Show Gist options
  • Save directlinks/9a019d940caa4516bcff3ff1358e06a0 to your computer and use it in GitHub Desktop.
Save directlinks/9a019d940caa4516bcff3ff1358e06a0 to your computer and use it in GitHub Desktop.
it has virtualservice, destinationrules, gateway and split is uri based
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: test-gateway
spec:
selector:
istio: ingressgateway # use Istio default gateway implementation
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
# Create a VirtualService to define how the traffic is to be distributed
kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
name: test-virtualservice
namespace: default
spec:
hosts:
- '*'
gateways:
- test-gateway
http:
- match:
- uri:
exact: /v1
rewrite:
uri: /
route:
- destination:
host: test-1
port:
number: 80
subset: v1
- match:
- uri:
exact: /v2
rewrite:
uri: /
route:
- destination:
host: test-1
port:
number: 80
subset: v2
---
# Create a Destination rule to specify where the traffic needs to go
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: test-destinationrule
spec:
host: test-1
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment