Skip to content

Commit 28f81e9

Browse files
Merge pull request #2 from crystaldust/docs/istio-as-controlplane
Add docs to use Istio as control plane.
2 parents f8baf9a + 84e1e7a commit 28f81e9

File tree

3 files changed

+219
-0
lines changed

3 files changed

+219
-0
lines changed

docs/istio-guides.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Use Istio as control plane
2+
=========================
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
:glob:
7+
8+
istio/discovery
9+
istio/router
10+

docs/istio/discovery.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Discovery
2+
======================
3+
4+
----
5+
6+
Introduction
7+
++++
8+
9+
Istio Pilot can be integrated with Mesher, working as the Service Discovery component.
10+
11+
Configuration
12+
++++
13+
14+
edit chassis.yaml.
15+
16+
**registrator.disabled**
17+
18+
Must disable registrator, because registrator is is used in client side discovery. mesher leverage server side discovery which is supported by kubernetes
19+
20+
**serviceDiscovery.type**
21+
22+
specify the discovery plugin type to "pilot" or "pilotv2", since Istio removes the xDS v1 API support from version 0.8, if you use Istio 0.8 or higher, make sure to set type to pilotv2.
23+
24+
**serviceDiscovery.address**
25+
26+
the pilot address, in a Istio environment, for xDS v1 API, pilot usually listens on the http port 8080, while for xDS v2 API, it becomes a grpc port 15010.
27+
28+
29+
examples
30+
++++
31+
32+
::
33+
34+
cse: # Using xDS v1 API
35+
service:
36+
Registry:
37+
registrator:
38+
disabled: true
39+
serviceDiscovery:
40+
type: pilot
41+
address: http://istio-pilot.istio-system:8080
42+
43+
::
44+
45+
cse: # Using xDS v2 API
46+
service:
47+
Registry:
48+
registrator:
49+
disabled: true
50+
serviceDiscovery:
51+
type: pilotv2
52+
address: grpc://istio-pilot.istio-system:15010

docs/istio/router.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Route Rule
2+
3+
Instead of using CSE and route config to manage route, mesher supports Istio as a control plane to set route rule and follows the envoy API reference to manage route. This page gives the examples to show how requests are routed between micro services.
4+
5+
## Mesher Configurations
6+
7+
In **Consumer** router.yaml, you can set router.infra to define which router plugin mesher fetches from. The default router.infra is cse, which means the routerule comes from route config in CSE config-center. If router.infra is set to be pilot, the router.address is necessary, such as the in-cluster istio-pilot grpc address.
8+
9+
```yaml
10+
router:
11+
infra: pilot # pilot or cse
12+
address: http://istio-pilot.istio-system:15010
13+
```
14+
15+
In **Both** consumer and provider registry configurations, the recommended one shows below.
16+
17+
```yaml
18+
cse:
19+
service:
20+
registry:
21+
registrator:
22+
disabled: true
23+
serviceDiscovery:
24+
type: pilot
25+
address: http://istio-pilot.istio-system:8080
26+
```
27+
28+
## Kubernetes Configurations
29+
30+
The provider applications of v1, v2 and v3 version could be deployed in kubernetes cluster as **Deployment** with differenent labels. The labels of version is necessary now, and you need to set env to generate nodeID in Istio system, such as **POD_NAMESPACE, POD_NAME** and **INSTANCE_IP**.
31+
32+
```yaml
33+
apiVersion: extensions/v1beta1
34+
kind: Deployment
35+
metadata:
36+
labels:
37+
version: v1
38+
app: pilot
39+
name: istioserver
40+
name: istioserver-v1
41+
namespace: default
42+
spec:
43+
progressDeadlineSeconds: 600
44+
replicas: 1
45+
revisionHistoryLimit: 10
46+
selector:
47+
matchLabels:
48+
app: pilot
49+
version: v1
50+
name: istioserver
51+
strategy:
52+
rollingUpdate:
53+
maxSurge: 1
54+
maxUnavailable: 1
55+
type: RollingUpdate
56+
template:
57+
metadata:
58+
labels:
59+
app: pilot
60+
version: v1
61+
name: istioserver
62+
spec:
63+
containers:
64+
- image: gosdk-istio-server:latest
65+
imagePullPolicy: Always
66+
name: istioserver-v1
67+
ports:
68+
- containerPort: 8084
69+
protocol: TCP
70+
resources: {}
71+
terminationMessagePath: /dev/termination-log
72+
terminationMessagePolicy: File
73+
env:
74+
- name: CSE_SERVICE_CENTER
75+
value: http://istio-pilot.istio-system:8080
76+
- name: POD_NAME
77+
valueFrom:
78+
fieldRef:
79+
apiVersion: v1
80+
fieldPath: metadata.name
81+
- name: POD_NAMESPACE
82+
valueFrom:
83+
fieldRef:
84+
apiVersion: v1
85+
fieldPath: metadata.namespace
86+
- name: INSTANCE_IP
87+
valueFrom:
88+
fieldRef:
89+
apiVersion: v1
90+
fieldPath: status.podIP
91+
volumeMounts:
92+
- mountPath: /etc/certs/
93+
name: istio-certs
94+
readOnly: true
95+
dnsPolicy: ClusterFirst
96+
initContainers:
97+
restartPolicy: Always
98+
schedulerName: default-scheduler
99+
securityContext: {}
100+
terminationGracePeriodSeconds: 30
101+
volumes:
102+
- name: istio-certs
103+
secret:
104+
defaultMode: 420
105+
optional: true
106+
secretName: istio.default
107+
```
108+
109+
## Istio v1alpha3 router configurations
110+
111+
[Traffic-management](https://istio.io/docs/tasks/traffic-management/request-routing/) gives references and examples of Istio new router rule schema. First, subsets is defined according to labels. Then you can set route rule of differenent weight for virtual services.
112+
113+
```yaml
114+
apiVersion: networking.istio.io/v1alpha3
115+
kind: DestinationRule
116+
metadata:
117+
name: istioserver
118+
spec:
119+
host: istioserver
120+
subsets:
121+
- name: v1
122+
labels:
123+
version: v1
124+
- name: v2
125+
labels:
126+
version: v2
127+
- name: v3
128+
labels:
129+
version: v3
130+
```
131+
132+
> **NOTICE: The subsets only support labels of version to distinguish differenent virtual services, this constrains will canceled later.**
133+
134+
```yaml
135+
apiVersion: networking.istio.io/v1alpha3
136+
kind: VirtualService
137+
metadata:
138+
name: istioserver
139+
spec:
140+
hosts:
141+
- istioserver
142+
http:
143+
- route:
144+
- destination:
145+
host: istioserver
146+
subset: v1
147+
weight: 25
148+
- destination:
149+
host: istioserver
150+
subset: v2
151+
weight: 25
152+
- destination:
153+
host: istioserver
154+
subset: v3
155+
weight: 50
156+
157+
```

0 commit comments

Comments
 (0)