In this post we will review pgAdmin deployment on a kubernetes cluster. pgAdmin is a free open source tool enabling monitoring and development on PosgreSQL.
pgAdmin requires the components listed below.
The Service
apiVersion: v1
kind: Service
metadata:
name: pgadmin-service
spec:
selector:
configid: pgadmin-container
type: ClusterIP
ports:
- port: 80
targetPort: 80
name: tcp-api
protocol: TCP
The Configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: pgadmin-configmap
data:
servers.json: |
{
"Servers": {
"1": {
"Name": "Demo PostgreSQL",
"Group": "Demo",
"Host": "postgresql-rw",
"Port": 5432,
"MaintenanceDB": "demo",
"Username": "admin",
"Password": "admin",
"SSLMode": "disable"
}
}
}
This configmap enables us to add predefined PostgreSQL servers that the pgAdmin service can connect to.
The Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgadmin-deployment
spec:
replicas: 1
selector:
matchLabels:
configid: pgadmin-container
template:
metadata:
labels:
configid: pgadmin-container
spec:
serviceAccountName: pgadmin-service-account
containers:
- name: pgadmin
image: dpage/pgadmin4:9.15.0
env:
- name: PGADMIN_DEFAULT_EMAIL
value: admin@pgadmin.com
- name: PGADMIN_DEFAULT_PASSWORD
value: admin
- name: PGADMIN_LISTEN_ADDRESS
value: "0.0.0.0"
volumeMounts:
- name: pgadmin-configmap
mountPath: /pgadmin4/servers.json
subPath: servers.json
volumes:
- name: pgadmin-configmap
configMap:
name: pgadmin-configmap
The user and password specified here are the login to the pgAdmin gui, and are not relevant to the PostgreSQL DB credentials.
Final Note
We have reviewed deployment of pgAdmin on a kubernetes cluster. In case we have a PostgreSQL in our solution, pgAdmin is a free and easy to use suite providing the tools to monitor and view the PostgreSQL database status and data. It is highly recommended to add it along the database.
No comments:
Post a Comment