0

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 192.168.0.131 (master), 192.168.0.132(worker1) and 192.168.0.133(worker 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.

2
  • We do have the same problem, are you able to find the solution? If so, please update here
    – Mani
    Aug 27, 2022 at 15:01
  • Yes for that, I have used the Metal-LB configuration that mentioned in below comment. In that one I have given desired IP range in IP Pool config. After that assign desired IP to the application which can be accessible to the that particular IP. Aug 31, 2022 at 4:16

1 Answer 1

1

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

1
  • MetalLB links works for me base on my expectation. Aug 30, 2021 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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