I am developing a golang app that uses Google Pub/Sub client library. I am using Google container engine for deployment. I followed the following steps for deployment -
- Build golang binary using
CGO_ENABLED=0 GOOS=linux go build -o bin/app app.go
- Build a docker image using dockerfile shown below.
- Create kubernetes deployment.
Dockerfile -
FROM scratch
ADD bin/app /
CMD ["/app"]
The app starts fine and I can see some initial debug logs. However, when I try to instantiate a pub/sub client using client, err := pubsub.NewClient(ctx, projectId)
, the method call never returns. I do not see the log message printed right after this statement.
I have "Cloud Pub/Sub" permission enabled on my GKE cluster. Also, the app runs without any issues on my local machine.
What might be the issue?