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?
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.