How to expose every kubernetes pods to the outside of the cluster through one host and port using rancher?

  docker, kubernetes, load-balancing, rancher

I have 4 machines, and set up Rancher in one, and created a kubenetes cluster called ml with all machines joined, and a project called Default with some Namespaces like tf1, tf2 and torch…, in which I have deployed some stateful workloads like tf232, and there are some pods inside the workload.

The pods are based on docker images like tensorflow/tensorflow:2.3.2-gpu-jupyter, so the port 8888 is exposed using type NodePort.

Every pod are assigned a VIP address, so I can easily execute curl http://10.42.1.30:8888 (10.42.1.30 is a pod VIP), but as described https://kubernetes.io/docs/concepts/services-networking/service/#nodeport, I think I can execute curl http://10.102.35.40:godkonws (10.102.35.40 is the node IP) too, but I can’t find a port correspondingly in rancher website.

enter image description here

Even I set a specific number like 30112, still I got failed: Connection refused. when executing curl http://10.102.35.40:30112. So what’s wrong with it?

And the most important thing is: I want to access the jupyter server in every pods outside of the cluster using one GATEWAY, how can I achieve that?

I have tried manually config nginx proxy_pass, but it’s manual.

e.g.

http://control_panle/?ip=10.42.1.37&port=8888 -> http://10.42.1.37:8888
http://control_panle/?ip=10.42.1.38&port=8888 -> http://10.42.1.38:8888
...
http://control_panle/?ip=10.42.1.255&port=8888 -> http://10.42.1.255:8888

enter image description here

Source: Docker Questions

LEAVE A COMMENT