<p>The use case you described is one that is covered by <code>ingress-controller</code>. Ingress controller will listen to an static IP which is mapped to kubernetes service of type <code>LoadBalancer</code> and will then forward the traffic to the pods as required.</p>
<p>LoadBalancer Services are used to create services that listen to traffic from outside the cluster.</p>
<p>One you assign a static IP in your network, you can then configure the ingress-controller to listen to the same IP.</p>
<p>Examples of ingress-controllers include <a href="https://kubernetes.github.io/ingress-nginx/" rel="nofollow noreferrer">nginx-ingress</a>,Traefik etc.</p>
<p>Nginx atleast listens to both TCP/UDP protocols and just need port to k8s service mapping to forward traffic to the proper pod.</p>
<p>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).</p>
<p>If not using helm you can create the objects on your own.</p>
<p><a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/" rel="nofollow noreferrer">MetalLB and considerations on bare metal</a></p>

CC BY-SA 4.0
2021-08-30T06:11:49.863Z
MetalLB links works for me base on my expectation.
Bhargav Lalaji
CC BY-SA 4.0
2021-08-26T12:47:59.380Z
2021-08-26T12:58:22.223Z
2021-08-26T12:58:22.223Z
rohatgisanat
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>FYI, I am using kubernetes cluster over bare metal.</p>

CC BY-SA 4.0
2022-08-27T15:01:56.517Z
We do have the same problem, are you able to find the solution? If so, please update here
Mani
CC BY-SA 4.0
2022-08-31T04:16:47.747Z
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.
Bhargav Lalaji
<kubernetes><linux><ubuntu>
How to assign static IP to Kubernetes cluster?
Bhargav Lalaji
# How to assign static IP to Kubernetes cluster?

(Asked by: username_0 on 2021-08-26)

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.

**Tags:** kubernetes, linux, ubuntu

> **Comments:**
> **username_1**: We do have the same problem, are you able to find the solution? If so, please update here  
> **username_0**: 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.  

---

## 1 answers

### Answer by username_2 on 2021-08-26. Score: 1 | Accepted answer

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](https://kubernetes.github.io/ingress-nginx/),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](https://kubernetes.github.io/ingress-nginx/deploy/baremetal/)

> **Comments:**
> **username_0**: MetalLB links works for me base on my expectation.  

---

