Jul 16, 2021 10:08
Bye man, good luck!
Jul 16, 2021 10:05
Also try printing the values from application startup to make sure they're being read properly
Jul 16, 2021 10:05
I think the issue is with your database url string :) try setting the environment variables pointing to override your spring settings, e.g:

- name: spring.datasource.url
value: jdbc:postgresql://postgres.home:5432/home

And same for username and password.
Jul 16, 2021 09:54
I think this should work for you
Jul 16, 2021 09:54
PGPASSWORD=$DB_PASSWORD psql -h postgres.home -p 5432 -U $DB_USER -d home
Jul 16, 2021 09:53
can you connect to the database from there now? try installing psql cli inside your pod
Jul 16, 2021 09:53
telnet is fine
Jul 16, 2021 09:53
so you can establish connection
Jul 16, 2021 09:50
or just ping postgres.home
Jul 16, 2021 09:50
ok so now you're inside try running telnet postgres.home 5432
Jul 16, 2021 09:48
winpty kubectl exec -it <<pod-name>> -n home -- bash
Jul 16, 2021 09:47
Ah, I see. Do you have git bash or something? If not you can try adding a winpty at the beginning of the command
Jul 16, 2021 09:43
kubectl exec -it <<pod-name>> -- bash

What's after the -- is the command to execute inside the pod, if bash doesn't work try with bin/bash, sh, or bin/sh
Jul 16, 2021 09:43
so you should be able to bash or sh in there
Jul 16, 2021 09:43
that image is ubuntu based AFAIK
Jul 16, 2021 09:42
So, your docker image is postgres:13.2
Jul 16, 2021 09:42
is your postgresql runtime windows?
Jul 16, 2021 09:39
or sh, depending your runtime
Jul 16, 2021 09:38
to ssh there just do kubectl exec -it <<pod-name>> -- bash
Jul 16, 2021 09:38
yes, exec into the pod should work
Jul 16, 2021 09:38
I don't think you have to specify the port again, try only with postgres
Jul 16, 2021 09:36
I think would be better if you first try to establish connection to the database from the pod, can you ssh into it and run a telnet postgres.home 5432?
Jul 16, 2021 09:36
Could you also share here the full value of your jdbc url string? It should look something like this jdbc:postgresql://postgres.home/home
Jul 16, 2021 09:36
Aha, I see
Jul 16, 2021 09:32
Could you try removing type: NodePort from your service? From what I understand you're trying to reach your service from within the cluster so you should use ClusterIP (default value)
Jul 16, 2021 09:32
I can see in your project that your dev profile is hitting localhost and the prod one is hitting postgres. Are you using prod profile in your deployment? Your application property is also using dev. Also to use kubernetes dns resolver you must specify the namespace as well, try with postgres.default instead of just postgres in the database connection string
Jul 16, 2021 09:32
Could you try setting the variables' value directly in the deployment template? For example - name: spring.datasource.password valueFrom: secretKeyRef: name: dev-db-secret key: password
 
May 28, 2021 09:36
I'm not a js guy so I can't help much there :(
May 28, 2021 09:36
Or try with other configurations for this prisma stuff
May 28, 2021 09:36
I think you should ask another question specific to nodejs/prisma setup now
May 28, 2021 09:35
Umm :/ I'm not sure then, what you're having is not a kubernetes issue anymore as you can connect to your database from other clients
May 28, 2021 09:32
This image is what you're deploying
image: lordrafiq/ecom-master
May 28, 2021 09:32
and have you generated a new docker image with this new url?
May 28, 2021 09:30
And you are deploying this to try connect to the database? Where are you configuring the db connection?
May 28, 2021 09:29
I'm asking now about the client (your nodejs application) how are you running it?
May 28, 2021 09:28
Ok but this what you have here is the deployment of your database
May 28, 2021 09:27
The deployment.yaml of your client
May 28, 2021 09:27
Could you show me how you are deploying it?
May 28, 2021 09:26
I mean but are you deploying your code to the cluster as a deployment ? Or you're running it from the IDE?
May 28, 2021 09:26
Given that it's a database I'd recommend doing a port-forwarding as you don't want to expose it through the public internet
May 28, 2021 09:26
If you want to access the database from your machine you have a few options
May 28, 2021 09:25
You won't be able to access it from your machine
May 28, 2021 09:25
This domain postgres-srv.default.svc.cluster.local only exists inside the kubernetes cluster
May 28, 2021 09:25
...
May 28, 2021 09:25
How are you trying this code? Are you running it locally?
May 28, 2021 09:23
According to their docs, you should connect doing somethnig like this

datasource db {
provider = "postgresql"
url = "postgresql://postgres:[email protected]:5432/postgresdb?schema=public"
}
May 28, 2021 09:22
You mentioned you're using prisma orm or something
May 28, 2021 09:22
How are you trying to establish the connection from your other client?
May 28, 2021 09:20
Then the issue is with your client specifically
May 28, 2021 09:20
so yes, you were able to connect :)