Kubernetes Postgres ClusterIP service name

95 Views Asked by At

I have installed pact broker by looking into this website and also installed Postgres using this website in Kubernetes. I have changed the Postgres service to ClusterIP and I have added the DB connection string as a secret.

apiVersion: v1
kind: Secret
metadata:
  name: pact-broker-secret
  namespace: pact
type: Opaque
data:
  # Encode in base64 the database URL string, I.e: postgres://pact:pact@postgres-svc/pact
  PACT_BROKER_DATABASE_URL: <REPLACE-WITH-YOUR-DB-CONNECTION-STR>

But the pact-broker is crashing and giving this error

! Unable to load application: URI::InvalidURIError: bad URI(is not URI?): "postgres://pact:pact@postgres-svc/pact\n"                                                                   

     bundler: failed to load command: puma (/pact_broker/vendor/bundle/ruby/2.7.0/bin/puma)                                                                                                     │
    │ URI::InvalidURIError: bad URI(is not URI?): "postgres://pact:pact@postgres-svc/pact\n" 



   kubectl get svc -n pact
NAME              TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
postgres-svc      ClusterIP      10.240.71.100   <none>        5432/TCP         3h8m

I base64 encoded the service name of the Postgres i.e. "postgres-svc.pact.svc" and added as PACT_BROKER_DATABASE_URL in k8s secret

0

There are 0 best solutions below