Kubernetes pod unable to connect to rabbit mq instance running locally

后端 未结 2 2034
暖寄归人
暖寄归人 2020-12-22 04:49

I am moving my application from docker to kubernetes \\ helm - and so far I have been successful except for setting up incoming \\ outgoing connections.

One particul

2条回答
  •  醉话见心
    2020-12-22 05:17

    You are exposing port 80 for both, the pod and the service. Then you curl on port 5672.

    Either expose port 5672 of the pod and curl it directly, or expose port 5672 of the service and keep port 80 on the pod, and curl on port 5672 of the service.

    This would be a high level "sketch" of how to hit a pod:

    you -curl-> service1(80:80) -> pod1(80)
    you -curl-> service2(80:5672) -> pod2(5672)
    

    So say you have two pods. One of them is serving on port 80, and the other one on port 5672. You can create two services; each of them targeting one pod. The services can be running on port 80 and map the requests to the ports 80 and 5672 of the pods.

    Now you can't make one service to do the both forwarding. Needs to be one service per pod. Can be a deployment, or a group of pods, but these need to be serving on the same port.

提交回复
热议问题