I have an Flask + SQLAlchemy deployed in Kubernetes, using Amazon AWS as cloud provider (Amazon EC2 machines) with a PostgreSQL RDS.
Sometimes an excetion arises when a request is performed:
psycopg2.OperationalError: could not translate host name "xxx.yyy.eu-west-1.rds.amazonaws.com" to address: Name or service not known
The Amazon RDS instance is located at the same VPC that the Kubernetes cluster, so DNS resolutions must turn into internal IP within the VPC.
I've tried to use Kubernetes kube-dns built-in stubDomains forcing to resolve *.rds.amazonaws.comDNS requests through VPC DNS resolver (in my case 10.0.0.2) but the exception keeps arising.
Does anybody have an idea of what's going wrong?
Thanks in advance.