Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

routing traffic to a public Kubernetes service on AWS EC2

I have a kubernetes (0.15) cluster running on CoreOS instances on Amazon EC2

When I create a service that I want to be publicly accessible, I currently add some private IP addresses of the EC2 instances to the service description like so:

{
  "kind": "Service",
  "apiVersion": "v1beta3",
  "metadata": {
    "name": "api"
  },
  "spec": {
    "ports": [
      {
        "name": "default",
        "port": 80,
        "targetPort": 80
      }
    ],
    "publicIPs": ["172.1.1.15", "172.1.1.16"],
    "selector": {
      "app": "api"
    }
  }
}

Then I can add these IPs to an ELB load balancer and route traffic to those machines.

But for this to work I need to have a maintain the list of all the machines in my cluster in all the services that I am running, which feels wrong.

What's the currently recommended way to solve this?

  • If I know the PortalIP of a service is there a way to make it routable in the AWS VPC infrastructure?
  • Is it possible to assign external static (Elastic) IPs to Services and have those routed?

(I know of createExternalLoadBalancer, but that does not seem to support AWS yet)

like image 966
levinalex Avatar asked Oct 20 '22 12:10

levinalex


1 Answers

If someone will reach this question then I want to let you know that external load balancer support is available in latest kubernetes version.

Link to the documentation

like image 176
Vyacheslav Enis Avatar answered Oct 27 '22 23:10

Vyacheslav Enis