How to change Kubernets / PostgreSQL connection credentionsls and host

Viewed 10

I want to adapt the example here

https://www.enterprisedb.com/blog/how-deploy-pgadmin-kubernetes

I want to change the following

need the host be localhost the user / password to access postgreSQL server vis Admin4 be :

postgres / admin

But I dont know what shout be changed in the files

pgadmin-secret.yaml file : (the password is SuperSecret)

sapiVersion: v1
kind: Secret
type: Opaque
metadata:
 name: pgadmin
data:
 pgadmin-password: U3VwZXJTZWNyZXQ=
 

pgadmin-configmap.yaml file :

apiVersion: v1
kind: ConfigMap
metadata:
 name: pgadmin-config
data:
 servers.json: |
   {
       "Servers": {
         "1": {
           "Name": "PostgreSQL DB",
           "Group": "Servers",
           "Port": 5432,
           "Username": "postgres",
           "Host": "postgres.domain.com",
           "SSLMode": "prefer",
           "MaintenanceDB": "postgres"
         }
       }
   }
   

pgadmin-service.yaml file

apiVersion: v1
kind: Service
metadata:
 name: pgadmin-service
spec:
 ports:
 - protocol: TCP
   port: 80
   targetPort: http
 selector:
   app: pgadmin
 type: NodePort
 

The pgadmin-statefulset.yaml :

apiVersion: apps/v1
kind: StatefulSet
metadata:
 name: pgadmin
spec:
 serviceName: pgadmin-service
 podManagementPolicy: Parallel
 replicas: 1
 updateStrategy:
   type: RollingUpdate
 selector:
   matchLabels:
     app: pgadmin
 template:
   metadata:
     labels:
       app: pgadmin
   spec:
     terminationGracePeriodSeconds: 10
     containers:
       - name: pgadmin
         image: dpage/pgadmin4:5.4
         imagePullPolicy: Always
         env:
         - name: PGADMIN_DEFAULT_EMAIL
           value: user@domain.com
         - name: PGADMIN_DEFAULT_PASSWORD
           valueFrom:
             secretKeyRef:
               name: pgadmin
               key: pgadmin-password
         ports:
         - name: http
           containerPort: 80
           protocol: TCP
         volumeMounts:
         - name: pgadmin-config
           mountPath: /pgadmin4/servers.json
           subPath: servers.json
           readOnly: true
         - name: pgadmin-data
           mountPath: /var/lib/pgadmin
     volumes:
     - name: pgadmin-config
       configMap:
         name: pgadmin-config
 volumeClaimTemplates:
 - metadata:
     name: pgadmin-data
   spec:
     accessModes: [ "ReadWriteOnce" ]
     resources:
       requests:
         storage: 3Gi

the following commands work OK with the original yaml files ad I get the Admin4 connect form in a web page

But even with the unchanged files, I have a bad username/password error

0 Answers
Related