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.
user_data
into the launch template for the ASG for the EKS node group? Theaws_eks_node_group
resource has alaunch_template
block enabling targeting your customlaunch_template
resource: registry.terraform.io/providers/hashicorp/aws/latest/docs/….