zalando / zalando/postgres-operator

Not able to Acces to database from outside in k8s

Open
#2,450 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5.2k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
3

Description

I have created a Postgres pod and service but i am not able to access i from pgAdmin4 from outside.

host = ($minikube ip)
port = 31515

but i am getting error:
connection to server at "($minikube ip)", port 31515 failed, timeout expired.

apiVersion: v1
kind: PersistentVolume
metadata:
name: postgresdb-persistent-volume
labels:
type: local
app: postgresdb
spec:
storageClassName: manual
capacity:
storage: 256m
accessModes:
- ReadWriteMany
hostPath:
path: "/data/db"

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-persistent-volume-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 256m

apiVersion: apps/v1
kind: Deployment
metadata:
name: postgresdb
labels:
app: postgresdb
spec:
replicas: 1
selector:
matchLabels:
app: postgresdb
template:
metadata:
labels:
app: postgresdb
spec:
containers:
- name: postgresdb
image: postgres
ports:
- containerPort: 5432
env:
- name: POSTGRES_PASSWORD
value: postgres
- name: POSTGRES_USER
value: postgres
volumeMounts:
- mountPath: /var/lib/postgres/data
name: db-data
volumes:
- name: db-data
persistentVolumeClaim:
claimName: db-persistent-volume-claim

apiVersion: v1
kind: Service
metadata:
name: postgresdb
labels:
app: postgresdb
spec:
type: NodePort
ports:
- port: 5432
targetPort: 5432
nodePort: 31515
selector:
app: postgresdb

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue contains only an inline Kubernetes manifest for a PostgreSQL Deployment and NodePort Service; no repository file or test is named. Start by reviewing the Service and external-access setup, then reproduce the timeout with the stated Minikube host and port. Done would require a confirmed cause and a documented, verifiable way to connect from pgAdmin4.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, postgres
Domain
databases, devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.