0

I am writing an app using spring boot, postgres and minikube. But when I apply app and db files I got an error:

Error by db:

FATAL: password authentication failed for user "root" DETAIL: Role "root" does not exist. Connection matched pg_hba.conf line 100: "host all all all scram-sha-256".

Error by app:

Caused by: org.postgresql.util.PSQLException: The server requested SCRAM-based authentication, but no password was provided.

I dont know why postgres is looking for user "root" although I set user "postgres". Also I set configuration like

kubectl exec -it pod-name -- sh psql -h postgres -U postgres

But it doesnt help. Thanks for advance

deployment.yml

kind: Service
apiVersion: v1
metadata:
  name: lab4-minikube
  labels:
    name: lab4-minikube
spec:
  ports:
    - nodePort: 30163
      port: 8080
      targetPort: 8080
      protocol: TCP
  selector:
    app: lab4-minikube
  type: NodePort

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: lab4-minikube
spec:
  selector:
    matchLabels:
      app: lab4-minikube
  replicas: 3
  template:
    metadata:
      labels:
        app: lab4-minikube
    spec:
      containers:
        - name: lab4-minikube
          image: 12413/lab4-minikube:1.5
          ports:
            - containerPort: 8080
          env:   # Setting Enviornmental Variables
            - name: DB_HOST   # Setting Database host address from configMap
              value: postgres
            - name: DB_NAME  # Setting Database name from configMap
              value: PaymentLab3
            - name: POSTGRES_USER  # Setting Database username from Secret
              value: postgres
            - name: POSTGRES_PASSWORD # Setting Database password from Secret
              value: "12345"
  • There are some information missing to be able to help. Would be nice to have more information on the `image: 12413/lab4-minikube:1.5` and a full log. But, from what you are saying, I guess it is an image with the postgres DB AND a spring boot app so I think it might be some error in the configuration of the image and/or the properties for the spring boot app. – grekier Apr 19 '23 at 13:18

0 Answers0