简体   繁体   中英

Google PubSub. Communication From AppEngine to Kubernetes pod and from one Kubernetes pod to another Kubernetes pod

How can I send and receive messages in those two cases?

We are migrating our app from appengine to kubernetes. We have two microservices distributed in this way:

Development environment

  • Service 1: Running on a Kubernetes pod (cluster named 1). It was running on AppEngine
  • Service 2:Running on a Kubernetes pod (cluster named 1). It was running on AppEngine

Problem is that Service 1 keeps sending pubsub messages to service 2 on AppEngine. It should send pubsub messages to service 2 running on Kubernetes

Production environment

  • Service 1: Running on AppEngine but soon it will be running on a Kubernetes pod (cluster named 1)
  • Service 2: Running on AppEngine but soon it will be running on a Kubernetes pod (cluster named 1)

In production environment, nowadays service 1 and 2 communicate via pubsub. Which (and in what order) is the best way to start migrating both services in production environment to Kubernetes pods?

I was thinking about moving both service 1 and 2 at the same time to Kubernetes and start using http rest to send and receives message between them (that would mean stop using Google PubSub) but I am not sure. Another problem I see is that Push endpoints require https and my external ip from my kubernetes service is http

PubSub messages are sent to a topic. Every listener to that topic (Eg both GAE service 2 and k8s service 2) will receive the messages sent.

If you want to differentiate the messages based on the origin (GAE and k8s) the easiest way to create another topic. And only configure this new topic in the k8s services.

However, I don't see which could be the issue of sharing the pubsub topic if the services do the same.

The solution was:

1) To change pubsub subscription to pull type

2) Create service account credentials

3) Adapted service code (now running in Kubernetes) so that it actually pulls pubsub messages

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