How do I host a simple html code on kubernetes within our network?

654 Views Asked by At

I am trying to host a simple html static site on kubernetes and was able to set everything working as expected but when I used load balancer in the service its exposed to public.

I tried to use nodeport option but our node dont have public IP to access it.

With just custer IP Iam unable to access it as well.

How do we host site only internally and which approach is the right one.

I started to look in to ingress controllers but then could not ways to install it to use it.

Any help is appreciated.

1

There are 1 best solutions below

0
On

Posting this answer as a community wiki to give more of a baseline approach and to point to the possible solutions.

Feel free to edit/expand.


Answering the question from the title:

How do I host a simple html code on kubernetes within our network?

This question is mainly related to the Services and how they work. Assuming that you already have a Deployment with it, the best course of actions would be to reach to the documentation of your cloud provider on the support of various Services and how you can connect to them. In general you would connect to this Deployment (with some html code) either by:

  • Service of type NodePort - port (30000-32767) on each Node will be opened for accessing the Deployment
  • Service of type LoadBalancer - IP address will be requested for the Service which you can access to get to the Deployment (can be internal or external)

As this topic is related to cloud-managed solutions and it's requirement is to connect to the Service from the network hosted by a cloud-provider, I'd reckon one of the solutions would be to look for objects like:

  • Internal Ingress
  • Internal LoadBalancer

This objects will be created in a way that you could access them only from the internal network (which I'm assuming you are connected to with your VPN).

Examples of such implementations across some cloud providers:

A side note!

You can use Service of type Loadbalancer (internal one) to be the entrypoint for your Ingress controller like ingress-nginx:


Additional resources: