AWS EC2 routing traffic from an instance in a private subnet through an instance within a public subnet

42 Views Asked by At

I've the following problem.

I'm trying to setup a k3s cluster on a fleet of ec2 instances (for study purposes) so far I've a working cluster, as well as a HAProxy to load-balance incoming request, I can reach my cluster from my machine with kubectl, aswell applying some manifests.

Problem is, I cannot pull image from the cluster as all the masters instances are on a private subnet without an internet gateway (I'm getting ImagePullBackOff as pods status).

As far as I see, it's not possible to directly assign an ec2 instance as a subnet's internet gateway, and I'm not knowledgeable enough in AWS to know about a mechanism to do.

I've also though about designating the internet gateway to the k3s cluster directly (since the load-balancer can be reach from the master's subnet).

Is it possible to assign my HAProxy instance as the internet gateway of those instances, in order to avoid assign public ip's to the cluster instances ? If no is there another way to do so without relying on the builtin aws solution ? I don't want to use ALB or ELB to keep the cost low.

I haven't trying anything specific yet as no solution is feeting my requirements. Other solution would be to add an image repository with direct connection the internet gateway in order to provide the needed images to the cluster.

0

There are 0 best solutions below