Search code examples
kubernetesgoogle-kubernetes-enginekubectlgoogle-cloud-pubsub

Subscribe cloud pub/sub topic from app running on Kubernetes


I have created an pub/sub topic to which I will publish a message every time an new object is uploaded to the bucket. Now I want to create a subscription to push a notification to an endpoint every time a new object is uploaded to that bucket. Following the documentation, I wanted something like that:

gcloud alpha pubsub subscriptions create orderComplete \ --topic projects/PROJECT-ID/topics/TOPIC \ --push-endpoint http://localhost:5000/ENDPOINT/ --ack-deadline=60 However my app is running on kubernetes and it seems that pub/sub cannot reach my endpoint. Any suggestions?


Solution

  • As standing in documentation

    In general, the push endpoint must be a publicly accessible HTTPS server, presenting a valid SSL certificate signed by a certificate authority and routable by DNS.

    So you must expose your service via HTTPS using Ingress as described there: https://cloud.google.com/kubernetes-engine/docs/concepts/ingress