-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat: Added custom AMI support for managed node groups #1473
feat: Added custom AMI support for managed node groups #1473
Conversation
Help me understand it. When you don't specify a custom AMI, then EKS merges your template with something else that calls bootstrap.sh, but if you do specify a custom AMI it doesn't, right? That is why you add /etc/eks/bootstrap.sh ${cluster_name} ? It that case, shouldn't that line be conditionally added only if image_id is present? (Also, if it is not really required, I'd prefer not to make changes that trigger changes to existing clusters, so adding something like %{if image_id} ..... %{ endif } could be a good idea, although, not sure, maybe "improving the template" is better than doing tricky conditionals, in any case, this is not the point of my question in this specific case) |
Ok, I'll try to explain. About bootstrapping managed worker node with default AMI from AWS blog:
So as we can see, if we are going to use custom AMI in Managed Node Group, then provisioning of the bootstrap script and execution of it are solely on us. Before my PR there was no invocation of I got your idea, thank you. It makes perfect sense to call |
I added bootstrap execution on condition - only when custom AMI is specified. Sorry for the delay, review will be much appreciated. |
@barryib @jaimehrubiks may I ask you for a review, please? |
I am not a maintainer, although I may test it in a near future. I do have another question though. With this approach, I guess you are expecting that your custom AMI does have a file called /etc/eks/bootstrap.sh don't you? I wonder if it could be better to read the content of that file from the original AMI, and then put it between those IFs. |
@jaimehrubiks, yes, you are right, at this moment I expect that the custom AMI must have a
So I think it's better to leave the bootstrap script provisioning for a customer, since the definition of the custom AMI itself means that the AMI should be created and it can be customized as one needs. We just give guidelines, such as "Provide the script in the |
@barryib @jaimehrubiks hey guys, could I have a review please? |
@barryib @jaimehrubiks @antonbabenko guys, I'm sorry for pushing, but can we get it going? In any direction at least 😅 |
Great job! Could any of maintainers review this PR? |
@mvoitko thank you for approving! I see that one of a jobs failed, I'll fix it and hopefully we merge this. |
Oh i need this.. Can i have it now? Pretty please :) |
@mvoitko @antonbabenko hey guys, I've merged master into my branch and now I can't run the workflows. Could you please trigger them? On my local machine |
@andreyBar I clicked the "Approve and run" button here in this PR, so it should be fine now. |
@antonbabenko thank you. Nevertheless, I still get the same error on the terraform_docs pre-commit hook. Trying to find out why... |
@andreyBar You need to use |
@antonbabenko I find out the issue. My local Edit: and yes, I've also switched to |
@antonbabenko @barryib @mvoitko I believe the PR is ready to be merged, could you please take a look at it and review it? |
@antonbabenko may I please ask you to have a look? |
Co-authored-by: Anton Babenko <anton@antonbabenko.com>
@antonbabenko thank you for the suggestions. You are right! I've added them to PR. |
@antonbabenko am I blacklisted? 😅 |
@andreyBar You are far from being blacklisted for making such a great contribution :) The problem or rather the state of fact is that we have been working through 70+ issues and PRs over the last 3 weeks when the active work resumed in addition to other things we have (e.g., full-time work). Let's see if @daroga0002 or @lisfo4ka approve this PR. If they have no objections, I will merge it and release it. |
@antonbabenko thank you very much, I'm glad to hear it 😃 Yeah, it's a tough time as I can see. A lot of PR's and issues. I'm not aware of the news, but probably increasing the number of maintainers could help? P.S. Sorry for pushing with PR. |
@@ -4,3 +4,6 @@ | |||
${pre_userdata} | |||
|
|||
sed -i '/^KUBELET_EXTRA_ARGS=/a KUBELET_EXTRA_ARGS+=" ${kubelet_extra_args}"' /etc/eks/bootstrap.sh | |||
%{ if run_bootstrap_script } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this is optional and rely on ami_id?
how this differ from amazon delivered AMI (how they launching bootstrap part?), asking as I never checked this and just using AWS AMIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't now exactly how it works, but I think that if you don't specify a custom AMI, then EKS merges your init scripts with their snippet that does the bootstrap process. However, when you use a custom AMI, they expect you to provide a fully-working init script that includes the bootstrapping section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, @jaimehrubiks is totally right. Here is my comment about this topic - #1473 (comment).
@andreyBar You said: "I'm not aware of the news, but probably increasing the number of maintainers could help?" Well, everybody is welcome to join the discussions happening in the issues and PRs to help us with triage and close existing issues. It is a lot of work that requires EKS and Terraform knowledge. |
v17.17.0 has been just released. |
@antonbabenko as mentioned by @ArchiFleKs in another PR #1577 (comment), it looks like this work is incomplete as the module isn't adding all of the correct @ArchiFleKs I don't have any MNGs running as without ASG tagging or an alternative they're not usable to us, do you have the full merged userdata from a default one, ideally one with taints and labels set? With this we should be able to see how to structure the |
I think now with taint being supported they are set at runtime by an external controller, so there is no need to replicate them here, I dont see them in usedata but I see the custom labels set with Here is the launchtemplate userdata created by this terraform module for example:
Then another launchtemplate is created by EKS with this userdata:
My guess is that when using custom AMI the launchtemplate clone is not being created ? I'm really a guess here because the doc does not explain much about how it works internally and how label and taints are implemented:
I think we would also need some insights from people who actually are using MNG with custom AMIs |
@ArchiFleKs the docs (see Specifying an AMI > Need to provide user data to pass arguments to the bootstrap.sh file included with an Amazon EKS optimized AMI and the User data in a launch template tab) specifically call out the use of manually setting the bootstrap arguments. So for me the outstanding question is how the taints are set, everything else is well documented. |
The readme for |
I've added #1580 to resolve this. @ArchiFleKs could you take a look for me? |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
PR o'clock
Description
Added support for custom AMI inside Managed Node Groups to keep up with AWS feature - https://aws.amazon.com/blogs/containers/introducing-launch-template-and-custom-ami-support-in-amazon-eks-managed-node-groups/.
Please note, that for the correct work of custom AMI the user should supply a bootstrap script to the machine. It can be done via user data or built-in inside AMI itself.
Changes:
Checklist