问题
I am setting up a solution in Google Cloud. I need a RabbitMQ queue broker and a WebAPI developed in .NET Core 2.2. The idea is for the WebAPI to connect to RabbitMQ to receive messages.
I have mounted RabbitMQ with GKE in a cluster of kubernetes with RabbitMQ Cluster, obtained in Marketplace. I have mounted the WebAPI in Cloud Run. Both components are raised in a standard way, without any particularity for publication.
The WebAPI uses port 5001 for HTTP traffic, and apparently the listener that subscribes to RabbitMQ to receive messages uses port 5672.
The problem is that uploading the WebAPI to Cloud Run doesn't work, apparently because Cloud Run only exposes one port for HTTP traffic and therefore the other port, 5672, is blocked.
By mounting the same WebAPI in a container on kubernetes, it does expose port 5001 and 5672 and works fine.
Can a WebAPI be published to Cloud Run that, in addition to exposing port 5001 for HTTP traffic, also exposes port 5672 (in this case to open a TCP connection) and thus be able to connect to RabbitMQ?
回答1:
No.
Cloud Run (fully managed) always exposes services a single port (on :443) over HTTPS.
来源:https://stackoverflow.com/questions/61893589/is-it-posible-to-expose-5001-http-and-5672-tcp-ports-in-a-cloud-run-service