Accessing a local postgres database from a rails app running on a Minikube cluster

12/16/2020

I have a rails app running on a Minikube cluster locally. However this app is unable to talk to the postgres database that is outside this Minikube cluster. (Just like my production environment would be)

I run in to a could not connect to server: Connection refused is the server running on host "127.0.0.1" and accepting TCP/IIP connections on port 5432

I have added the following:

kind: Service
apiVersion: v1
metadata:
  name: postgres
  namespace: default
spec:
  type: ExternalName
  externalName: host.docker.internal
  ports:
    - name: port
      port: 5432

Does my rails app need any special configuration? is there another way to do this? What host/port do I need to specify for my rails app? Thanks!

-- ShivamD
docker
kubernetes
minikube
postgresql
ruby-on-rails

0 Answers