How to build the network architecture for a kubernetes raspberry cluster?

4/8/2021

I want to deploy a website on my kubernetes cluster.

I followed this guide to set up my kubernetes cluster on my set of raspberries. Now I have tested it with some nginx containers and it works to a certain degree since I need to find the correct ip of the machine it is deployed on.

Now that I have a signed up a domain I like to forward the traffic to my deployed website on my kubernetes cluster.

I have done this before with nginx, certbot and letsencrypt without containerisation. Now I am just missing the part how kubernetes handles the network. I assumed it was similar to swarms network which forwards all the request to the correct machine. But kubernetes does it differently.

TLDNR: How to deploy a website on a self build raspberry pi kubernetes cluster?

-- A.Dumas
deployment
kubernetes
raspberry-pi

1 Answer

4/8/2021

You need to create Kubernetes Service (documentation) to expose the web service to the outside world.

There are two types of Services relevant to deployments outside of cloud providers:

ClusterIP: Exposes the Service on a cluster-internal IP. Choosing this value makes the Service only reachable from within the cluster. This is the default ServiceType.

NodePort: Exposes the Service on each Node's IP at a static port (the NodePort). A ClusterIP Service, to which the NodePort Service routes, is automatically created. You'll be able to contact the NodePort Service, from outside the cluster, by requesting <NodeIP>:<NodePort>.

So what you probably want is a NodePort service, which will expose the service on some fixed port on each of your Nodes (documentation and examples)

-- Malt
Source: StackOverflow