0

I've created a pod for my java application and exposed it as a node-port service.
I'm able to access it using curl master address:nodeport only inside the cluster and not from the outside(say my browser).
The purpose of node-port service is to allow external access to pods right? then why can't access it.

kubernetes version v1.13,
Running in the digital ocean cloud.

Expected output: masteraddress:nodeport should work externally

output for kubectl describe svc <svc>
enter image description here

AATHITH RAJENDRAN
  • 4,689
  • 8
  • 34
  • 58

5 Answers5

0

Check whether the node port is serving your application on host: netstat -tunpl | grep "your node port" and also with the Local Address as 0.0.0.0 or your machines' IP.

PrakashG
  • 1,642
  • 5
  • 20
  • 30
Vicky
  • 121
  • 5
  • yeah @vicky I checked and it worked fine using `localaddress:nodeport`, `masterip:nodeport`, and `netstat -tunpl | grep "my node port"` returns my node port – AATHITH RAJENDRAN Feb 08 '19 at 04:14
0

Rather then using NodePort change it to load balancer and access it directly over load balancer Ip address. or eles you can make ingress controller which will make one ingress and you can redirect and exposes services

using ingress and service type load balancer both way you can you can acess application outside

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
0

Just try and locate the worker node's IP address on which your pod is running.
change master-address:nodeport to workernode-address:nodeport, it worked for me :)

AATHITH RAJENDRAN
  • 4,689
  • 8
  • 34
  • 58
-1

If you are sure everything is correct and running,Check if port is blocked by firewall rules and open it for external traffic.

-1

It looks from your output like your pod selector is not correct. Your output should be something like

Nodeport: "selector label" 31605/TCP

You have "unset", so this nodeport is not connected to anything.

I have a nodeport example on my blog.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574