0

Service.Yaml

pods.yaml

i am not able to access my application from browser. What mistake i am doing ?

if i give Ipaddress:30010 -> my app is not getting reached. (attached my pod.yaml and service.yaml here in attachment)

  • what exactly do you expect to happen when you call a db connection port with a webbrowser? – meaningqo Nov 29 '21 at 09:46
  • How are you trying to access the database ? pgAdmin or psql or any other way. – Tarun Khosla Nov 29 '21 at 10:33
  • It looks like you've included two links to image files of some sort instead of including the Kubernetes YAML files as text in your question; can you edit the question to fix this? What's the exact URL you're connecting to; where does the IP address come from? What error do you get? – David Maze Nov 29 '21 at 11:30

2 Answers2

0

You need to add targetPort setting in the ports section on your Service.yaml. This specifies the destination port of the container.

ports:
  - name: http
    port: 5432
    targetPort: 5432
    nodePort: 30010

port is a setting for in-cluster communication, that other containers in the cluster can access via {serviceName}:port.

Daigo
  • 815
  • 1
  • 5
  • 16
0

You need to find your node ip. If you are using minikube then you find node ip list. By running kubectl cluster-info. Then in your browser go to http:[node-ip]:30010

Akshay Gopani
  • 473
  • 4
  • 16