0

I'm starting to learn Kubernetes and there's one thing I currently don't understand. Let's say I have three virtual machines (VMware) with some unique external IPs (let's say X,Y,Z IP addresses). Let's say we want to expose 3 different websites on port 80. Let's say we want to have each website on each IP address.

Without using Kubernetes I can simply create Docker container on each machine and expose it easily. (X:80, Y:80, Z:80)

How can I approach this problem with Kubernetes? What would be equivalent solution to one I described above without Kubernetes? There's Ingress, but it would require something like X:80 , X:80/secondsite, X:80/thirdsite.

How is this problem approached if I need more IP addresses than virtual machines? Is it possible to assign range of IP addresses to single VM and use them with Ingress or in some different way?

I apologize in advance if these questions seem trivial, but I will be greatful for answers that would give me some direction.

Adiqq
  • 101
  • 1
  • 1

1 Answers1

0

How this problem is solved in the cloud like AWS/Google

You create your deployment and service for the deployment. Then you create a ingress controll(nginx for example). You then create a LoadBalancer type service for that controller that will go create a load balancer like a ELB. Kubernetes maps the ELB listeners ports back to the node ports opened by the ingress controller service. Then you create an ingress that says this host goes to this service. The ingress controller reloads with the config changed.

When you roll your own you have to basically create a ingress service with a hard coded nodeport. If you don't set a nodeport on the service then kubernetes will pick a random one. If you want to automate it you can pre-select a unique nodeport. kubernetes will then open that same node port on all nodes to get traffic.

Then on your load balancer somehow you give it a new VIP and say send 80->nodeport on all the nodes.

Mike
  • 21,910
  • 7
  • 55
  • 79