How to expose node's container ports to network

7/31/2018

I created kubernetes cluster using rancher with 2 physical computers (Windows).

  • master : 172.20.5.246
  • node : 172.20.5.227

Once service is deployed via rancher server and when it also mapped to 81 of host as per below

enter image description here

I cannot access app via 172.20.5.227:81 ? Even I expose port via node's firewall

-- Shalitha Suranga
kubernetes
rancher

1 Answer

7/31/2018

Assumption: your service work internally meaning works if you check the service in the Master or in the Nodes and you got access to the service:

You need to change the service type to NodePort. By doing so you will will expose the service external.

  1. kubectl -n edit service
  2. Edit the file and change the type to NodePort (as the example:enter image description here

enter image description here

  And than Browser to https://NODEIP:NODEPORT .

-- Oron Golan
Source: StackOverflow