Skip to content

Commit ae691bf

Browse files
authored
Merge pull request #855 from awsdocs/gdc-subnet-tag-auto
steps to tag subnets for auto mode
2 parents 983e32c + 7cfa451 commit ae691bf

File tree

4 files changed

+104
-2
lines changed

4 files changed

+104
-2
lines changed

latest/ug/automode/auto-configure-alb.adoc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ EKS Auto Mode creates and configures Application Load Balancers (ALBs). For exam
2424
* Kubectl configured to connect to your cluster
2525
** You can use `kubectl apply -f <filename>` to apply the sample configuration YAML files below to your cluster.
2626
27+
[NOTE]
28+
====
29+
EKS Auto Mode requires subnet tags to identify public and private subnets.
30+
31+
If you created your cluster with `eksctl`, you already have these tags.
32+
33+
Learn how to <<tag-subnets-auto>>.
34+
====
35+
36+
2737
## Step 1: Create IngressClassParams
2838

2939
Create an `IngressClassParams` object to specify {aws} specific configuration options for the Application Load Balancer. Use the reference below to update the sample YAML file.
@@ -39,8 +49,6 @@ spec:
3949
scheme: internet-facing
4050
```
4151

42-
43-
4452
## Step 2: Create IngressClass
4553

4654
Create an `IngressClass` that references the {aws} specific configuration values set in the `IngressClassParams` resource. Note the name of the `IngressClass` . In this example, both the `IngressClass` and `IngressClassParams` are named `alb`.

latest/ug/automode/auto-configure-nlb.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ When you create a Kubernetes service of type `LoadBalancer` in EKS Auto Mode, EK
1111

1212
EKS Auto Mode handles Network Load Balancer provisioning by default for all services of type LoadBalancer - no additional controller installation or configuration is required. The `loadBalancerClass: eks.amazonaws.com/nlb `specification is automatically set as the cluster default, streamlining the deployment process while maintaining compatibility with existing Kubernetes workloads.
1313

14+
[NOTE]
15+
====
16+
EKS Auto Mode requires subnet tags to identify public and private subnets.
17+
18+
If you created your cluster with `eksctl`, you already have these tags.
19+
20+
Learn how to <<tag-subnets-auto>>.
21+
====
22+
1423

1524
== Sample Service
1625

latest/ug/automode/auto-elb-example.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ spec:
139139
controller: eks.amazonaws.com/alb
140140
----
141141

142+
[NOTE]
143+
====
144+
EKS Auto Mode requires subnet tags to identify public and private subnets.
145+
146+
If you created your cluster with `eksctl`, you already have these tags.
147+
148+
Learn how to <<tag-subnets-auto>>.
149+
====
150+
142151
Then create the Ingress resource. Create a file named `05-ingress.yaml`:
143152

144153
[source,yaml]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
[#tag-subnets-auto]
2+
= Tag subnets for EKS Auto Mode
3+
:info_titleabbrev: Tag subnets
4+
5+
include::../attributes.txt[]
6+
7+
If you use the load balancing capability of EKS Auto Mode, you need to add {aws} tags to your VPC subnets.
8+
9+
== Background
10+
11+
These tags identify subnets as associated with the cluster, and more importantly if the subnet is public or private.
12+
13+
Public subnets have direct internet access via an internet gateway. They are used for resources that need to be publicly accessible such as load balancers.
14+
15+
Private subnets do not have direct internet access and use NAT gateways for outbound traffic. They are used for internal resources such as EKS nodes that don't need public IPs.
16+
17+
To learn more about NAT gateways and Internet gateways, see link:vpc/latest/userguide/extend-intro.html["Connect your VPC to other networks",type="documentation"] in the Amazon Virtual Private Cloud (VPC) User Guide.
18+
19+
== Requirement
20+
21+
At this time, subnets used for load balancing by EKS Auto Mode are required to have one of the following tags.
22+
23+
=== Public subnets
24+
Public subnets are used for internet-facing load balancers. These subnets must have the following tags:
25+
26+
|===
27+
|Key |Value
28+
29+
|`kubernetes.io/role/elb`
30+
|`1` or ``
31+
|===
32+
33+
=== Private subnets
34+
Private subnets are used for internal load balancers. These subnets must have the following tags:
35+
36+
|===
37+
|Key |Value
38+
39+
|`kubernetes.io/role/internal-elb`
40+
|`1` or ``
41+
|===
42+
43+
== Procedure
44+
45+
Before you begin, identify which subnets are public (with Internet Gateway access) and which are private (using NAT Gateway). You'll need permissions to modify VPC resources.
46+
47+
=== {aws} Management Console
48+
49+
. Open the Amazon VPC console and navigate to Subnets
50+
. Select the subnet to tag
51+
. Choose the Tags tab and select Add tag
52+
. Add the appropriate tag:
53+
* For public subnets: Key=`kubernetes.io/role/elb`
54+
* For private subnets: Key=`kubernetes.io/role/internal-elb`
55+
. Set Value to `1` or leave empty
56+
. Save and repeat for remaining subnets
57+
58+
=== {aws} CLI
59+
60+
For public subnets:
61+
[source,bash]
62+
----
63+
aws ec2 create-tags \
64+
--resources subnet-ID \
65+
--tags Key=kubernetes.io/role/elb,Value=1
66+
----
67+
68+
For private subnets:
69+
[source,bash]
70+
----
71+
aws ec2 create-tags \
72+
--resources subnet-ID \
73+
--tags Key=kubernetes.io/role/internal-elb,Value=1
74+
----
75+
76+
Replace `subnet-ID` with your actual subnet ID.

0 commit comments

Comments
 (0)