Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes NodePort not accesible from outside

I'm trying to use the latest bitnami postgres chart to deploy postgres to a local kubernetes cluster (mac os, docker desktop 4.4.2, kubernetes 1.22.5): https://github.com/bitnami/bitnami-docker-postgresql

I have set the node port:

primary:
  service:
    # Kubernetes Service type
    type: NodePort
    nodePorts:
      # Node port for PostgreSQL
      postgresql: '30000'

the service is visible:

NAME                             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
service/postgres-nodeport      NodePort    10.111.195.149   <none>        5432:30000/TCP   9m56s

but I cant access it from outside, eg:

psql -h localhost -p 30000 -U myusername -d mydatabase

but I think it is configured correctly, because when I execute port-forward postgres is available:

kubectl port-forward pod/postgres-nodeport-0 30000:5432 
like image 305
paka Avatar asked Dec 28 '25 19:12

paka


1 Answers

I found a solution: You need to set the port to higher than 30000, e.g. 30001 but its strange, because earlier it worked with port 30000, and the documentation says that the port range is 30000-32767

like image 100
paka Avatar answered Dec 30 '25 17:12

paka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!