简体   繁体   中英

How to use Istio Ingress to forward STOMP protocol of RabbitMQ in Kubernetes?

I tried with this Gateway , and VirtualService , didn't work.

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: stomp
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: stomp
      protocol: TCP
    hosts:
    - rmq-stomp.mycompany.com
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: rmq-stomp
spec:
  hosts:
  - rmq-stomp.mycompany.com
  gateways:
  - stomp
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        port:
          number: 61613
        host: rabbitmq.default.svc.cluster.local

There's no problem with the service, because when I tried to connect from other pod, it's connected.

Use tcp.match , not http.match . Here is the example I have found in istio gateway docs and in istio virtualservice dosc

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo-mongo
  namespace: bookinfo-namespace
spec:
  hosts:
  - mongosvr.prod.svc.cluster.local # name of internal Mongo service
  gateways:
  - some-config-namespace/my-gateway # can omit the namespace if gateway is in same namespace as virtual service.
  tcp:
  - match:
    - port: 27017
    route:
    - destination:
        host: mongo.prod.svc.cluster.local
        port:
          number: 5555

So your would look sth like:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: rmq-stomp
spec:
  hosts:
  - rmq-stomp.mycompany.com
  gateways:
  - stomp
  tcp:
  - match:
    - port: 80
    route:
    - destination:
        host: rabbitmq.default.svc.cluster.local
        port:
          number: 61613

Here is a similar question answered: how-to-configure-istios-virtualservice-for-a-service-which-exposes-multiple-por

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM