> 入口網關(Ingress Gateway)是 Istio 重要的資源對象之一,是用于管理網格邊緣入站的流量,通過入口網關就可以很輕松的将網格内部的服務暴露到外部提供通路。
#### 通過例子來了解

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: nginx-gw
spec:
selector:
app: istio-ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- nginx.test.com
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: nginx-vs
spec:
hosts:
- nginx.test.com
gateways:
- nginx-gw
http:
- route:
- destination:
host: nginx-svc
---
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nginx
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: 'nginx:latest'
name: nginx-deployment
通過指令通路 ``curl -H "Host: nginx.gateway.com" http://ingressgateway:nodeport/``
istio-ingressgateway 就是小區的大門(唯一的大門),所有進入的流量都需要經過
ingressgateway 相當于路标引導去到A B C D的一棟建築裡面,分開域名去導流
virtualservice 就像到建築裡的電梯一樣,按照不同的樓層進行管理路由的作用
destinationrule 到達具體的樓層後按照不同的門房号 1 2 3 4 進入到真正的屋裡去。