<p>I've set up a Kubernetes Cluster on a custom OpenStack Platform to which, I don't have any administration access. It is only possible to create Instances and assign Firewall-Rules to them. Each new instance will be automatically provided by a static external IPv4 Address which can be reached globally. This means, that I can't even create OpenStack Routers to my internal network.</p>

<p>So far so good, I've set up a Kubernetes Cluster using <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/" rel="nofollow noreferrer"><code>kubeadm</code></a>, <code>CoreDNS</code> and <code>flanel</code> as <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/#network-plugin-requirements" rel="nofollow noreferrer"><code>CNI</code></a>. The cluster Hardware Setup is as following:</p>

<ul>
<li>Kubernetes-Client and Server-Version: <code>1.14.3</code> linux/amd64</li>
<li>All Servers run on Fedora Cloud Base 28</li>
<li>1 Kubernetes Master</li>
<li>5 Worker Nodes</li>
<li>6 static external IPv4 addresses (one for each of the nodes)</li>
</ul>

<p>After the setup, I deployed my required services using <code>deployment</code>-files. Everything works as it should.</p>

<p>My question is now, how I can make the services externally accessible? Since I've no <code>LoadBalancer</code> provided by OpenStack? How is the best approach for this?</p>

<p>I'm asking this question after an estimated amount of four hours of Googling (maybe I'm just bad at it). I tried the suggested approaches from the <a href="https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/" rel="nofollow noreferrer">Documentation</a>, but it stays totally unclear for me, what the concept and the right approach for the task is.</p>

<p>For example I tried to assign external IPs to the Service by using for example</p>

<pre class="lang-sh prettyprint-override"><code>kubectl expose deployment $DEPLOYMENT_NAME \
                          --name=$SERVICE_NAME \
                          --port=$HOST_PORT \
                          --target-port=$TARGET_PORT \
                          --type=NodePort
</code></pre>

<p>or this</p>

<pre class="lang-sh prettyprint-override"><code>kubectl patch service $SERVICE_NAME -p '{"spec":{"externalIPs":["&lt;worker_host_ip&gt;"]}}'
</code></pre>

<p>Even if the external IP is now assigned, the routing to my destination service is still not routed properly, because as I get it, Kubernetes automatically assigns the hosts and random ports to the Pods (which is the desired behaviour), but with that in mind, every redeployment could crash the assigned IP to service mapping.</p>

<p>After your help and a big "Thank You!" in advance I expect, that I can assign the application ports of the containers, to the static IPv4 of one of the hosts and that Kubernetes automatically knows, that the deployed service will be routed over this specific IP even, if the Pods run on a different worker.</p>

Viktor Krimstein
<p>After a while of researching, I stumbled upon the <a href="https://metallb.universe.tf/" rel="nofollow noreferrer">MetalLB</a> implementation of a bare metal load-balancing solution for Kubernetes.
This helped me to solve the issue described above.
However from my point of view, MetalLB should be only used as last chance, since it is not production ready and requires excessive configration using the NGINX Ingress Controller solution to properly map the IPv4 distribution of a cluster.</p>

<p>Anyway a big big thank you to the above gentleman, which were willing to support me and give advice! </p>
