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