I am stuck with a very weird issue. I have a Kubernetes cluster in GKE which is in default VPN. Now I have my mongodb running in mongo atlas. I created a VPC peering for connecting to the same from my cluster. After that I run my express based services and everythinng works fine.
After adding to the VPC, I did whitelist 10.128.0.0/16(said in vpc docs) and 10.20.0.0/16(pod cidr). The problem started when I added a new service, a python flask service, which used mongopy to connect.
Now the new service is on the same network and is not able to connect to the mongo atlas service unless I add 0.0.0.0, which is open to all. This only happens during deployment. After deployment is a success, and the pod is green, can remove the open thing and everything works fine. Using the latest version of pymongo 4.6.1
Dockerfile
FROM python:3.9-slim-busterRUN apt-get update \&& apt-get install -y --no-install-recommends git \&& apt-get purge -y --auto-remove \&& rm -rf /var/lib/apt/lists/*WORKDIR /appCOPY ./requirements.txt /appRUN pip install -r requirements.txtCOPY . .ENV FLASK_APP=app.pyCMD ["gunicorn", "-k", "eventlet", "--timeout", "1500", "app:app", "-b", "0.0.0.0:8080"]
Any help is appreciated, at least ideas on how to debug. Have spent days on this.