Is there any way to assign static IP to Kubernetes cluster, in which any user can able to access its application over static IP only.

for an example, I have set up a cluster over (master), and 2). One dotnet application is running on nodeport 32000, which is accessible over all the cluster as expected.

Now I have to assign one IP which communicate to this cluster and user can get access on that. Also is there any way that we can use this IP for other applications as well which can be differentiate based on different ports not nodeport.

FYI, I am using kubernetes cluster over bare metal.


The use case you described is one that is covered by ingress-controller. Ingress controller will listen to an static IP which is mapped to kubernetes service of type LoadBalancer and will then forward the traffic to the pods as required.

LoadBalancer Services are used to create services that listen to traffic from outside the cluster.

One you assign a static IP in your network, you can then configure the ingress-controller to listen to the same IP.

Examples of ingress-controllers include nginx-ingress,Traefik etc.

Nginx atleast listens to both TCP/UDP protocols and just need port to k8s service mapping to forward traffic to the proper pod.

If you use Helm,it also provides the configuration to give it the static IP it should listen to. (It maps and creates the LoadBalancer svc object as part of its installation if used).

If not using helm you can create the objects on your own.

MetalLB and considerations on bare metal

  • MetalLB links works for me base on my expectation. Aug 30 '21 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.