Skip to main content

Cluster Endpoint Access

EKS exposes a Kubernetes API server endpoint for the cluster. You control who can reach that endpoint through two variables.
At least one endpoint (public or private) must be enabled at all times. The module defaults to private-only access (endpoint_private_access = true, endpoint_public_access = false).

Endpoint Configurations

Nodes communicate with the control plane entirely within your VPC. No public internet exposure for the API server.
Ensure VPC DNS resolution and DNS hostnames are enabled when using the private endpoint. Nodes must be able to resolve the private endpoint hostname.

Restricting Public Access CIDRs

When endpoint_public_access = true, you can restrict which IP addresses are allowed to reach the API server by setting endpoint_public_access_cidrs. When you restrict access this way, you must also ensure that your nodes and Fargate pods are included in the allowed CIDRs (or use the private endpoint alongside it), because EKS nodes also contact the public endpoint to register with the cluster.
If you restrict endpoint_public_access_cidrs and do not enable the private endpoint, your nodes will fail to register because they cannot reach the public API server from addresses outside the allowed CIDRs.

Subnet Configuration

The module distinguishes between two subnet variables that serve different purposes. If control_plane_subnet_ids is not provided, the control plane ENIs are placed in subnet_ids. Providing separate control plane subnets lets you expand the node subnet pool later without replacing the control plane.

Security Group Architecture

The module creates two security groups by default:

Cluster Security Group

An “additional” security group attached to the cluster control plane. Allows customizing inbound and outbound rules for control-plane-to-node communication. Defaults include the AWS minimum recommendations plus NTP and HTTPS egress.

Node Security Group

A shared security group attached to all node groups created by the module. Provides the minimum access needed for nodes to join the cluster. Enable recommended rules with node_security_group_enable_recommended_rules.

Extending the Cluster Security Group

Use security_group_additional_rules to add rules to the cluster security group. Set source_node_security_group = true to reference the node security group as the source.

Extending the Node Security Group

Use node_security_group_additional_rules to open up node-to-node communication or allow traffic from specific sources. Set source_cluster_security_group = true to reference the cluster security group.

Bringing Your Own Security Groups

You can disable the module-managed security groups and supply externally created ones instead.
You can also attach additional externally created security groups to the control plane without disabling the module-managed one:

IP Family

The ip_family variable controls whether pods and services receive IPv4 or IPv6 addresses.
ip_family can only be set at cluster creation time. Changing it forces replacement of the entire cluster.

Troubleshooting: Nodes Not Registering

Nodes failing to register with the EKS control plane is almost always a networking problem. Work through these checks in order:
1

Verify at least one endpoint is enabled

Check that either endpoint_public_access or endpoint_private_access is true. Both cannot be false.
2

Check node-to-endpoint reachability

  • Private subnets: nodes need a NAT gateway (or NAT instance) and the correct route table entry to reach a public endpoint, or use the private endpoint.
  • Public subnets: nodes must launch with a public IP. Enable this via the subnet default or on the launch template.
3

Check CIDR restrictions

If endpoint_public_access_cidrs is set, node outbound IPs must be included. If nodes use a NAT gateway, add that gateway’s Elastic IP to the allowed CIDRs.
4

Enable the private endpoint for internal traffic

Setting endpoint_private_access = true allows nodes to communicate with the API server over the private network. Ensure VPC DNS resolution and DNS hostnames are enabled.
5

Add VPC endpoints for air-gapped environments

If nodes have no public internet access at all, add VPC Interface Endpoints for: ec2, ecr.api, ecr.dkr, and s3 (Gateway endpoint). This allows nodes to pull images and make API calls without internet access.
This error (commonly triggered by the AWS Load Balancer Controller) occurs when multiple security groups attached to nodes carry the same kubernetes.io/cluster/<CLUSTER_NAME> = owned tag.By default, EKS creates a cluster primary security group with this tag. The error appears when you also attach the module-created node security group and set attach_cluster_primary_security_group = true, resulting in two tagged security groups on the same nodes.Resolution — choose one approach:Option 1: Disable the module node security group and use the cluster primary SG only:
Option 2: Do not attach the cluster primary security group (keep only the module node SG):
If using Custom Networking, ensure your ENIConfig resources only reference the security group matching your chosen approach.