Kubunetes(Non-Clouds) Access cluster from outside(Public IP)

2/3/2019

I want to make my own cluster, So I plan to buy 3 raspberry pi( for being as server) 1 for master node and 2 for worker nodes. I got one public Ip(router). And I will use kubeadm to create a master node. And use token to join master node from other 2 remaining ras-pi. All raspberry pi are in the same LAN ( router). Normally if I run webserver on my laptop on port 80. My laptop has 192.168.1.3 private Ip. And I do port forwarding from router to my laptop. I can access website through Public Ip.And if I run my webserver on container and do load balancing with k8s on 2 worker nodes( raspberry pi) So how can I handle it. Where should I do port forward to from my router. So how can I bring client from public ip to my any service in my own cluster. I research for it and I can use node port to access but I think it’s not good to do it because it access directly to a host machine not through cluster so another way is making my own loadbalancer but I don’t know How to do

So I want to get some advice how to do it or anything that to achieve my goal. I don’t care if it’s tough or difficult. I just want to success it to get some knowledge and publish it please can someone clarify me

-- Yao Pitak
kubectl
kubernetes
networking
server

2 Answers

2/3/2019

Use nginx ingress controller to route the calls to k8s services in the cluster. That way you don't have to use node port type service objects.

-- P Ekambaram
Source: StackOverflow

2/4/2019

Please consider using of MetalLB (a load-balancer implementation for bare metal Kubernetes clusters) together with the NGINX Ingress controller.

It would require to setup port forwarding in your home router on ports (80/443) to one of your worker nodes.

Here is how this setup would look like in your case:

enter image description here

-- Nepomucen
Source: StackOverflow