Skip to content

Commit 7babe87

Browse files
authored
chore: Update documentation related to default EKS node group settings and v18.x security group changes (#1760)
1 parent a1d28a7 commit 7babe87

File tree

5 files changed

+50
-9
lines changed

5 files changed

+50
-9
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,14 @@ module "eks" {
175175

176176
ℹ️ Only the pertinent attributes are shown for brevity
177177

178-
1. AWS EKS Managed Node Group can provide its own launch template and utilize the latest AWS EKS Optimized AMI (Linux) for the given Kubernetes version:
178+
1. AWS EKS Managed Node Group can provide its own launch template and utilize the latest AWS EKS Optimized AMI (Linux) for the given Kubernetes version. By default, the module creates a launch template to ensure tags are propagated to instances, etc., so we need to disable it to use the default template provided by the AWS EKS managed node group service:
179179

180180
```hcl
181181
eks_managed_node_groups = {
182-
default = {}
182+
default = {
183+
create_launch_template = false
184+
launch_template_name = ""
185+
}
183186
}
184187
```
185188

@@ -188,6 +191,9 @@ module "eks" {
188191
```hcl
189192
eks_managed_node_groups = {
190193
bottlerocket_default = {
194+
create_launch_template = false
195+
launch_template_name = ""
196+
191197
ami_type = "BOTTLEROCKET_x86_64"
192198
platform = "bottlerocket"
193199
}

UPGRADE-18.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Please consult the `examples` directory for reference example configurations. If
2929
- The previous iteration used a count over a list of node group definitions which was prone to disruptive updates; this is now replaced with a map/for_each to align with that of the EKS managed node group and Fargate profile behaviors/style
3030
- The user data configuration supported across the module has been completely revamped. A new `_user_data` internal sub-module has been created to consolidate all user data configuration in one location which provides better support for testability (via the [`examples/user_data`](https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/examples/user_data) example). The new sub-module supports nearly all possible combinations including the ability to allow users to provide their own user data template which will be rendered by the module. See the `examples/user_data` example project for the full plethora of example configuration possibilities and more details on the logic of the design can be found in the [`modules/_user_data`](https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/modules/_user_data_) directory.
3131
- Resource name changes may cause issues with existing resources. For example, security groups and IAM roles cannot be renamed, they must be recreated. Recreation of these resources may also trigger a recreation of the cluster. To use the legacy (< 18.x) resource naming convention, set `prefix_separator` to "".
32+
- Security group usage has been overhauled to provide only the bare minimum network connectivity required to launch a bare bones cluster. See the [security group documentation section](https://github.com/terraform-aws-modules/terraform-aws-eks#security-groups) for more details. Users upgrading to v18.x will want to review the rules they have in place today versus the rules provisioned by the v18.x module and ensure to make any necessary adjustments for their specific workload.
3233

3334
## Additional changes
3435

examples/eks_managed_node_group/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ Note that this example may create resources which cost money. Run `terraform des
3232
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
3333
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.64 |
3434
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
35+
| <a name="requirement_tls"></a> [tls](#requirement\_tls) | >= 2.2 |
3536

3637
## Providers
3738

3839
| Name | Version |
3940
|------|---------|
4041
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.64 |
4142
| <a name="provider_null"></a> [null](#provider\_null) | >= 3.0 |
43+
| <a name="provider_tls"></a> [tls](#provider\_tls) | >= 2.2 |
4244

4345
## Modules
4446

@@ -51,11 +53,13 @@ Note that this example may create resources which cost money. Run `terraform des
5153

5254
| Name | Type |
5355
|------|------|
56+
| [aws_key_pair.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/key_pair) | resource |
5457
| [aws_kms_key.ebs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
5558
| [aws_kms_key.eks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
5659
| [aws_launch_template.external](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template) | resource |
5760
| [aws_security_group.additional](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
5861
| [null_resource.patch](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
62+
| [tls_private_key.this](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |
5963
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
6064
| [aws_eks_cluster_auth.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster_auth) | data source |
6165
| [aws_iam_policy_document.ebs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |

examples/eks_managed_node_group/main.tf

+33-7
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,25 @@ module "eks" {
6868

6969
eks_managed_node_groups = {
7070
# Default node group - as provided by AWS EKS
71-
default_node_group = {}
71+
default_node_group = {
72+
# By default, the module creates a launch template to ensure tags are propagated to instances, etc.,
73+
# so we need to disable it to use the default template provided by the AWS EKS managed node group service
74+
create_launch_template = false
75+
launch_template_name = ""
76+
77+
# Remote access cannot be specified with a launch template
78+
remote_access = {
79+
ec2_ssh_key = aws_key_pair.this.key_name
80+
}
81+
}
7282

7383
# Default node group - as provided by AWS EKS using Bottlerocket
7484
bottlerocket_default = {
85+
# By default, the module creates a launch template to ensure tags are propagated to instances, etc.,
86+
# so we need to disable it to use the default template provided by the AWS EKS managed node group service
87+
create_launch_template = false
88+
launch_template_name = ""
89+
7590
ami_type = "BOTTLEROCKET_x86_64"
7691
platform = "bottlerocket"
7792
}
@@ -122,20 +137,23 @@ module "eks" {
122137

123138
# Use a custom AMI
124139
custom_ami = {
140+
ami_type = "AL2_ARM_64"
125141
# Current default AMI used by managed node groups - pseudo "custom"
126-
ami_id = "ami-0caf35bc73450c396"
142+
ami_id = "ami-01dc0aa438e3214c2" # ARM
127143

128144
# This will ensure the boostrap user data is used to join the node
129145
# By default, EKS managed node groups will not append bootstrap script;
130146
# this adds it back in using the default template provided by the module
131147
# Note: this assumes the AMI provided is an EKS optimized AMI derivative
132148
enable_bootstrap_user_data = true
149+
150+
instance_types = ["t4g.medium"]
133151
}
134152

135153
# Complete
136154
complete = {
137155
name = "complete-eks-mng"
138-
use_name_prefix = false
156+
use_name_prefix = true
139157

140158
subnet_ids = module.vpc.private_subnets
141159

@@ -173,10 +191,6 @@ module "eks" {
173191
}
174192
]
175193

176-
remote_access = {
177-
ec2_ssh_key = "my-ssh-key"
178-
}
179-
180194
update_config = {
181195
max_unavailable_percentage = 50 # or set `max_unavailable`
182196
}
@@ -475,6 +489,7 @@ resource "aws_launch_template" "external" {
475489
resource_type = "instance"
476490

477491
tags = {
492+
Name = "external_lt"
478493
CustomTag = "Instance custom tag"
479494
}
480495
}
@@ -503,3 +518,14 @@ resource "aws_launch_template" "external" {
503518
create_before_destroy = true
504519
}
505520
}
521+
522+
resource "tls_private_key" "this" {
523+
algorithm = "RSA"
524+
}
525+
526+
resource "aws_key_pair" "this" {
527+
key_name_prefix = local.name
528+
public_key = tls_private_key.this.public_key_openssh
529+
530+
tags = local.tags
531+
}

examples/eks_managed_node_group/versions.tf

+4
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ terraform {
1010
source = "hashicorp/null"
1111
version = ">= 3.0"
1212
}
13+
tls = {
14+
source = "hashicorp/tls"
15+
version = ">= 2.2"
16+
}
1317
}
1418
}

0 commit comments

Comments
 (0)