1

I'm following the example for creating an EKS managed node group from https://docs.aws.amazon.com/eks/latest/userguide/cni-increase-ip-addresses.html

The configuration requires me to pass additional arguments to the /etc/eks/bootstrap.sh script via the --kubelet-extra-args argument.

My EKS worker nodes are configured via a Terraform resource aws_eks_node_group

I can't find any option for configuring the resource that would allow me to pass the --kubelet-extra-args arguments.

Am I looking at the wrong place or is there no way to achieve this?

1

1 Answer 1

5

If you need to pass the --kubelet-extra-args you have the option of passing user data to the instance that can be used to perform common automated configuration tasks and even run scripts after the instance starts.

In my point of view, you should have a tpl (template) file with the script you will need to run when the node is created.

userdata.tpl file like this

#!/bin/bash
%{ if length(kubelet_extra_args) > 0 }
export KUBELET_EXTRA_ARGS="${kubelet_extra_args}"
%{ endif }
%{ if length(kubelet_extra_args) > 0 || length (bootstrap_extra_args) > 0 || length (after_cluster_joining_userdata) > 0 }

/etc/eks/bootstrap.sh --apiserver-endpoint '${cluster_endpoint}' --b64-cluster-ca '${certificate_authority_data}' ${bootstrap_extra_args} '${cluster_name}'

The previous userdata.tpl file was called using a templatefile function that renders all the values on the script.

In another file you gonna have, for instance, a resource called aws_launch_template or aws_launch_configuration that includes an user_data base64encode input like this.

Finally, apply all the changes and then create new nodes, they will be created with the new configuration.

Complete EKS node groups implementation here and an example of how to deploy it here

I hope it may useful for you.

2
  • Alright, I had hoped to avoid setting up a separate launch template but it looks like that's the only way. Aug 25, 2021 at 8:16
  • Hey @ChristianSeifert, yes I think is the only way, though, isn't a bad solution, I hope it works for you and your team, let me know if I can clarify any doubt
    – Hugo Lesta
    Aug 25, 2021 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.