Open grommir opened 6 years ago
Fixed by adding
@grommir you cannot name your service pgadmin because kubernetes creates a environment variable $NAME$_PORT and PGADMIN_PORT is used by PGADMIN itself.
It is not service name, just environment variable. Here is working yaml:
---
apiVersion: v1
kind: Service
metadata:
labels:
name: pgadmin
name: pgadmin
spec:
ports:
- port: 5050
selector:
name: pgadmin
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: pgadmin
spec:
replicas: 1
template:
metadata:
name: pgadmin
labels:
name: pgadmin
spec:
containers:
- image: fenglc/pgadmin4:2.1
name: pgadmin
env:
- name: DEFAULT_USER
value: postgres
- name: DEFAULT_PASSWORD
value: test
- name: PGADMIN_SERVER_NAME
value: test
- name: PGADMIN_PORT
value: "5050"
- name: DEBUG
value: "true"
ports:
- containerPort: 5050
name: pgadminport
volumeMounts:
# This name must match the volumes.name below.
- name: pvc-data-pgadmin
mountPath: /var/lib/pgadmin
volumes:
- name: pvc-data-pgadmin
persistentVolumeClaim:
# This disk must already exist.
claimName: pvc-data-pgadmin
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-data-pgadmin
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pvc-data-pgadmin
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
nfs:
# FIXME: use the right IP
server: 127.0.0.1
path: "/mnt/nfs/pgadmin"
I also had the same issue and fixed it by adding - name: PGADMIN_PORT value: "5050"
.
@grommir you cannot name your service pgadmin because kubernetes creates a environment variable $NAME$_PORT and PGADMIN_PORT is used by PGADMIN itself.
This is ingeniously evil. Thanks for saving a lot of time for me.
pgAdmin4 init process done. Ready for start up. Traceback (most recent call last): File "pgAdmin4.py", line 95, in <module> server_port = int(port) ValueError: invalid literal for int() with base 10: 'tcp://10.103.24.187:5050'