-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assign node public IPs from Elastic IP pool #440
Comments
To me this sounds like an operator could do this very nicely, I am actually not sure how this would fit into eksctl. Also, have you considered using an NLB? It's already available on Kubernetes via an annotation. |
@errordeveloper Thank you for your prompt reply! Indeed, it is possible to associate Elastic IPs manually, but that would have to be done after every scaling/node creation operation. Also, it doesn't seem straightforward: NLB does solve the problem 2. accessing the services from outside, but not 1. accessing private resources behind white-listing firewalls. |
It sounds like you actually want to use pre-allocated EIPs, is that correct? We can provide an option for using a pre-allocated EIP for the NAT gateway very easily.
I didn't suggest to do this manually, by "operator" I mean a component running inside the cluster that would automatically attach pre-allocated EIPs to nodes (could also allocate new ones and attach those).
Is that for egress? If you use |
That's how I do currently. It works reliably albeit wasteful on EIPs.
If all worker nodes do share the same public EIP, that should work (at least for outcoming traffic; I'm not sure how NAT will actually resolve incoming traffic from public EIP to worker node NodePorts though).
I think I'm missing the actual details :-) I.e. what is ASG config and what annotations should be placed on what objects? |
@aparamon I've updated my comment before I noticed your reply, you might want to re-read it. I gathered that there is no actual option for allocating EIPs as part of ASG (surprisingly). |
Exactly: AWS::AutoScaling::LaunchConfiguration is missing that. |
I think you'd be looking to use two things:
We don't have an option to pass pre-allocated EIP just yet, but it can be easily added. With regards to NLB, see Kubernetes docs. I am not quite sure if they allow you to attach a pre-allocated IP or not exactly.
We cannot do this, as one of the main design principle is to keep node bootstrap script as simple as possible with least number of input variables. The ideal place to do this would be in something like cluster autoscaler or a standalone operator. Hope this makes sense, also it'd mean you could actually re-use this in any Kubernetes cluster on EC2. |
@aparamon are you on Slack, perhaps better to chat in real time? :) |
I've just registered as aparamon |
Indeed, hooking instance userdata is hackey; let's consider another possibility! Currently, a NAT Gateway for private networks is created and assigned a freshly-acquired Elastic IP unconditionally: An option to supplying existing EIP for the NAT Gateway will solve current issue. What about introducing config parameter
? Potential extensions include multiple NAT Gateways, see #392 |
Hey! Just my two cents but natGateway:
eip: <EIP_ALLOC_ID> or natGatewayEIP: <EIP_ALLOC_ID> seem to make sense to me in eksctl. Otherwise, I believe you can use pre-created VPC and subnets, NAT gateways so that you can provide those to eksctl with For more sources of inspirations, I'd suggest looking into how this has been supported in an another tool. A managed subnet with pre-created EIP: A managed subnet with pre-created NGW(w/ or w/o EIP. It doesn't matter to the tool): |
I believe I understand the use-case that requires what's originally requested in this issue. You basically need a reliable way to assign EIPs before kubelet talks to the apiserver, in order to build an ingress/egress gateway limited to have a specific set of EIPs. It is used so that:
And you don't want to waste so much for additional NAT gateways and NLBs, or don't want to have a nodegroup per EIP which can results in many small nodegroups. Implementation-wise, I think I have the same feeling as @errordeveloper:
The only workable solution I have found so far is to use userdata or custom systemd unit, so that you can attach an EIP before kubelet starts talking to the apiserver. kubernetes-retired/kube-aws#219 I haven't tried it myself yet but as you've said, an k8s operator or a daemonset may be used instead if and only if you can reliably update the node IP address stored in K8S. Would assigning EIPs and then restarting every kubelet from the operator/daemonset work, or maybe just updating the node object via k8s api...? I'm not certain of that yet. |
Regardless of the above, If you don't need so many EIPs, or are ok with creating a set of nodegroups per EIP, what @errordeveloper had summarized above would work best:
|
@mumoshu Thanks for your comments! Having individual node EIPs assigned before kubelets start communicating to apiserver is not a requirement, fortunately. It is only required that pods use IP from specific pre-defined pool when talking to the outside world, e.g. private Docker repositories. So "NAT gateway for egress, NLB for ingress" sounds most simple and natural. |
@aparamon Thanks for claryfying! Yes, "NAT gateway for egress, NLB for ingress" would allow you to prepare EIP before your pods start, which does solve your issue and making the extreme case I've summarized irrelevant. Nice to see you found a simpler solution for your issue! |
Upon |
Some considerations on
One option that is generally working with But there is another, apparently simpler alternative: NodePort services!
Now you can access the services by What do you think of automating it? Maybe something like It is possible to further refine the scheme, by creating dedicated "load balancer" subnets initially, along with current private and public subnets. |
I'm withdrawing my previous statement. I think restarting kubelet isn't necessary, as kubelet would communicate with the apiserver via whatever public IP addr avaiable to the node. Either EIP or automatically assigned public IP would work. apiserver would need kubelet access in order for things like
This is cool! But now, I believe we can implement it with a simple daemonset external to eksctl given the above. The daemonset would work like the below:
|
@mumoshu The daemonset idea looks appealing! I'm not sure about |
Related: https://forums.aws.amazon.com/message.jspa?messageID=515725#613460 and the following comment hook into userdata. |
NAT with existing EIP looks awesome. As for assigning EIP from a work pool, we used a lambda function to routinely scan for new nodes. |
@hden for EKS-NODE-POOL=foo , do we just list all IPs, comma separated? The same question goes for EKS-IP-POOL=bar Also, I see variables INETANCE_TAG_KEY and INETANCE_TAG_VALUE - should it be INSTANCE_TAG_... instead? Also, how do you trigger the updates through CloudWatch? Thanks! |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
This seems like it is still needed or has something else been done on this? |
i am unable to see that a resolution was reached regarding adding this feature. if that is the case, please note there is still interest in being able to assign existing EIPs to NAT gateways and re-opening this issue would be much appreciated, thanks! |
Why do you want this feature?
Currently, worker node EC2 instances are (by default) created with dynamic/volatile public IPs. This is often sub-optimal:
Worker nodes are expected to have specific public IPs.
Having predictable public node IPs eliminates need for proxies.
What feature/behavior/change do you want?
Provide an option to assign worker nodes public IPs from AWS Elastic IP pool.
One possible implementation outlined in
kubernetes/kops#3182 (comment)
The text was updated successfully, but these errors were encountered: