How to configure ingress gateway in istio?

纵饮孤独 提交于 2019-12-04 20:46:44

First of all, as @Abhyudit Jain mentioned you need to correct port in VirtualService to 8000

And then you just add another port to your istio-ingressgateway service

kubectl edit svc istio-ingressgateway -n istio-system

add section:

ports:
  - name: http
    nodePort: 30001
    port: 15000
    protocol: TCP
    targetPort: 80

This will accept HTTP traffic on port 15000 and rout it to your destination service on port 8000

simple schema as follows:

incoming traffic --> istio-gateway service --> istio-gateway --> virtual service --> service --> pod

You batman service listens on port 8000 and forwards traffic to container's port 7000.

The istio traffic works like this:

ingress-gateway -> virtual-service -> destination-rule [optional] -> service

So your virtual service should be like:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: batman
spec:
  hosts:
  - "*"
  gateways:
  - batman-gateway
  http:
    - match:
      route:
      - destination:
          host: batman
          port:
            number: 8000  <--- change
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!