12.4Istio核心功能实践-部署bookinfo_batch

default命名空间打上标签istio-injection=enabled

$ kubectl label namespace default istio-injection=enabled

查看命令空间labels

kubectl  get namespaces --show-labels

部署应用

$ kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

确定Ingress的IP和端口

$ kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml

gateway上确定了域名和端口

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: httpbin-gateway
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "httpbin.example.com"
EOF

关注点:

hosts:域名

port:

​ number:端口

​ protocol:协议

域名和端口进来之后访问哪个服务由VirtualService负责

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin
spec:
  hosts:
  - "httpbin.example.com"
  gateways:
  - httpbin-gateway
  http:
  - match:
    - uri:
        prefix: /status
    - uri:
        prefix: /delay
    route:
    - destination:
        port:
          number: 8000
        host: httpbin

关注点:

hosts: 对应域名 gateways:对应的网关

http:http协议下

​ -match:

​ -uri:匹配到如下url的时候

​ route:路由到

​ -destination:

​ host:应用服务

​ port:的这个端口上

Last updated

Was this helpful?