1

0

I am using k8s to orchestrate an environment on a local network. My idea is to deploy a number of linux machines each of which should have its own "External" IP.

Right now I found guides to expose services on External IP (e.g. https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/), but this is tailored to expose services on a precise port.

My need is more targeted to expose an entire machine on a precise static IP and not just a port. This would allow me to easily deploy and reshape any network topology I need. Notice that doing it without exposing the IPs (hence using internal k8s routing/dns) is not an option because this environment should be interfaced with real/bare metal hardware already present in the network.

Here follows a little example of the desired result: enter image description here

Can anyone relate to this and let me know if this is even possible?

1

You should look at DaemonSets. You can configure it so that the Pods runs on each node of your Kubernetes cluster. Each individual Pod (running your Linux machine) can be exposed to outside network using the IP address of the node on which it is running.

My need is more targeted to expose an entire machine on a precise static IP and not just a port.

Before getting into further explanation, I should point out that there is nothing like exposing entire machines.

Access to any machine is always through a combination of IP address and Port. So you should decide based on which port you would like to access on the container.

Example:

Let's say I have a 3 node Kubernetes cluster, I can create a DaemonSet with the application/image of my choice. Below names/details are imaginary, but should give an idea on the mapping.

ubuntu-daemonset-pod-xyz    k8s-node-1    192.168.2.1
ubuntu-daemonset-pod-abc    k8s-node-2    192.168.2.2
ubuntu-daemonset-pod-hij    k8s-node-3    192.168.2.3

The Pods above can be "exposed" on the IP address of the node on which it is running. That is: ubuntu-daemonset-pod-xyz on 192.168.2.1.

2
  • Thanks, for your answer. Is it possible to expose a pod on a static IP different from the one of the nodes (see my picture above)? This setup would allow me to have more pods than nodes and moreover to place pods on different subnets – rakwaht Sep 17 '20 at 13:03
  • 1
    Any Pod can be configured to be accessible on the Node's IP called as NodePort. Even if you don't use DaemonSet. – seshadri_c Sep 17 '20 at 13:14

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.