Closed florian-besser closed 1 year ago
After wrangling with this problem for a bit I used the following solution:
eks_managed_node_group_defaults = {
disk_size = 20
instance_types = ["t3.medium"]
}
eks_managed_node_groups = {
foo = {
min_size = 1
max_size = 15
desired_size = 5
ami_type = "CUSTOM"
ami_id = data.aws_ami.eks_default.image_id
key_name = aws_key_pair.worker_node_access.key_name
enable_bootstrap_user_data = true
bootstrap_extra_args = "--kubelet-extra-args '--kube-reserved memory=0.2Gi,ephemeral-storage=1Gi --system-reserved memory=0.1Gi,ephemeral-storage=1Gi --eviction-hard memory.available<200Mi,nodefs.available<10%'"
}
}
Basically I removed remote_access
and replaced it with key_name
. I also removed create_launch_template=false
/ launch_template_name = ""
. The effect of that we're now again generating a launch template (with which we can use user_data
). This solves one part, but now we lost the SSH access. By adding key_name
we get SSH access back, and this time the key pair is persisted in the launch template, meaning we now have a launch template with custom arguments and SSH.
Maybe this could be added as an example when using remote_access
isn't permissible?
I am hesitant to do do anything for this - its down to understanding how the service handles these properties and its not down to the module itself. The module just enables you to use the service
If you use the default launch template provided by EKS Managed nodegroups - you can use remote access and disk size values but you can't set other values that are only available when using a custom launch template, and vice versa. The proper solution here, in my opinion, is to use SSM and not use SSH access
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
I tried to do something stupid, namely combine the example given for
remote_access
with the examples forenable_bootstrap_user_data
/pre_bootstrap_user_data
. I expected these things to work together as I wanted to create a node group to which I could a) connect via SSH and b) could pass custom kubelet settingsVersions
Module version [Required]: 18.31.2
Terraform version: v1.4.6
Provider version(s):
provider registry.terraform.io/hashicorp/aws v4.52.0
provider registry.terraform.io/hashicorp/cloudinit v2.2.0
provider registry.terraform.io/hashicorp/helm v2.8.0
provider registry.terraform.io/hashicorp/kubernetes v2.17.0
provider registry.terraform.io/hashicorp/local v2.3.0
provider registry.terraform.io/hashicorp/null v3.2.1
provider registry.terraform.io/hashicorp/random v3.4.3
provider registry.terraform.io/hashicorp/tls v4.0.4
Reproduction Code [Required]
Steps to reproduce the behavior:
Create an EKS managed node group with the following:
CUSTOM
/ custom AMI idremote_access
partremote_access
requires you to disable the launch template)bootstrap_extra_args
or any other change to the user_dataFor my example I followed https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/user_data.md#eks-managed-node-group for
bootstrap_extra_args
. I followed https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/examples/eks_managed_node_group/main.tf forssh_access
Expected behavior
Clear and concise error message that specifying
create_launch_template=false
/launch_template_name = ""
are incompatible withbootstrap_extra_args
& similar arguments. OR: Both settings applied,max-pods
should now be20
, while SSH access works.Actual behavior
The node group is created without any customer
user_data
being applied The SSH access works very nicely.max-pods
is17
, the default value AWS EKS applies it seems.Terminal Output Screenshot(s)
Applies successfully
Additional context
It would be really nice if we could get an example how to manage SSH access to nodes without disabling the launch template so we can still modify
user_data
.