Other Articles

EKS Cluster – Restrict Public Endpoint

Secure Configuration Checks > AWS

This check ensures that the API server endpoint of an Amazon EKS cluster is private or limited to specific CIDR ranges. By default, the endpoint is reachable from the entire internet. Anyone can then try to reach the Kubernetes API and attack it.

Check Details

  • Resource: EKS Cluster
  • Check: Restrict EKS cluster public endpoint (PublicEndpointRestricted)
  • Risk: Attackers can probe the Kubernetes API, guess or abuse credentials, and take control of the cluster and its workloads

Endpoint access modes

  • Public: The endpoint is reachable from the internet. It is compliant only if you limit it to trusted CIDR ranges.
  • Public and private: The endpoint is reachable from the internet and from inside the VPC. It is compliant only if you limit the public CIDRs. Worker nodes use the private path.
  • Private: The endpoint is reachable only from inside the VPC or from networks connected to it. This is the safest mode.

Remediation via AWS Console

  1. Log in to the AWS Management Console and open the Amazon Elastic Kubernetes Service (EKS) console.

    Amazon EKS Console
  2. In the left navigation pane, select Clusters and choose the affected cluster.

  3. Open the Configuration tab. Under the Networking section, click Endpoint access.

    EKS cluster networking configuration
  4. Configure the cluster API server endpoint access using one of the following options:

    • Private access only: Enable Private access and disable Public access to prevent access to the Kubernetes API server from the public internet.
    • Public and private access: Enable both Public access and Private access. Under Advanced settings, specify trusted CIDR ranges and remove unrestricted access such as 0.0.0.0/0 and ::/0, where applicable.
    Manage endpoint access for an EKS cluster
  5. Click Update to apply the endpoint access configuration.

  6. Wait for the endpoint access update to complete. Check the cluster's Updates tab and verify that the update status is Successful.

  7. Repeat these steps for every affected EKS cluster.

Note: Before disabling public access, ensure that administrators, CI/CD pipelines, and other management tools can access the private Kubernetes API endpoint through the cluster VPC or a connected network. If public access is retained, allow only trusted CIDR ranges. When restricting public access, ensure that the required NAT Gateway or other egress IP addresses used by worker nodes are included in the allowlist if private endpoint access is disabled.

Remediation via AWS CLI

  1. Log in to the AWS Management Console and click the CloudShell icon (>_) in the top-right corner.

    AWS CloudShell
  2. List the clusters whose public endpoint is open to the internet:

    for c in $(aws eks list-clusters --query 'clusters[]' --output text); do
      aws eks describe-cluster --name "$c" --output json | \
      jq -r '.cluster
        | select(.resourcesVpcConfig.endpointPublicAccess == true
            and (.resourcesVpcConfig.publicAccessCidrs
                 | any(.[]; . == "0.0.0.0/0" or . == "::/0")))
        | .name'
    done
    

    The command covers one region. Add --region <region> to each aws command to check another.

  3. Limit public access to trusted CIDR ranges and keep private access on:

    aws eks update-cluster-config \
    --name <cluster-name> \
    --resources-vpc-config '{"endpointPublicAccess":true,"endpointPrivateAccess":true,"publicAccessCidrs":["<trusted-cidr-1>","<trusted-cidr-2>"]}'
    

    To remove public access completely, use this command instead:

    aws eks update-cluster-config \
    --name <cluster-name> \
    --resources-vpc-config endpointPublicAccess=false,endpointPrivateAccess=true
    
  4. Wait for the update to finish:

    aws eks wait cluster-active --name <cluster-name>
    
  5. Verify the endpoint settings:

    aws eks describe-cluster \
    --name <cluster-name> \
    --query 'cluster.resourcesVpcConfig.{Public:endpointPublicAccess,Private:endpointPrivateAccess,Cidrs:publicAccessCidrs}'
    

Replace <cluster-name> with the name of the cluster, for example prod-cluster. Replace <trusted-cidr-1> and <trusted-cidr-2> with your own ranges, for example 203.0.113.0/24. Repeat steps 3 to 5 for each cluster.

Updated on 03 November, 2026