> 入口网关(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 进入到真正的屋里去。