I have an application pod running on a namespace named frontend and a database pod running on a different namespace named backend. I need to have communication between both the pods residing in different namespaces. The database container is up and running but while the application container has an error of crashloopbackoff.
When I saw the logs of the application pod, there is an error while resolving the database hostname which was provided through the environment variable PGHOST and was equal to the name of the database container. But it seems that the application container is unable to resolve the database host.
Therefore, how should I connect them. I suppose that the problem is due to different namespaces. So how do I connect them and make them communicate.
error:
> The Gemfile's dependencies are satisfied rake aborted!
> PG::ConnectionBad: could not translate host name "postgres" to
> address: Name or service not known