AWS EKS Cluster Network Initialization Configuration
TOC
Support Overview
Prerequisites
-
Prepare two subnets with the kubernetes.io/role/elb tag. For shared subnets, add the kubernetes.io/cluster/<cluster-name>: shared tag. See Adding Tags to Subnets.
-
If you have created an EKS cluster, import the Amazon EKS cluster.
-
Ensure kubectl, Helm, AWS CLI, and eksctl tools are available before deploying AWS Load Balancer Controller.
Note: After installing the tools, configure login information using the user who created the cluster via AWS CLI, and test if AWS CLI and eksctl tools are correctly installed.
-
Obtain ACCOUNT_ID, REGION, and CLUSTER_NAME in advance, and replace
<ACCOUNT_ID>,<REGION>, and<CLUSTER_NAME>in the documentation with the actual values.Note: ACCOUNT_ID is the Account ID of the user who created the cluster, REGION is the cluster region, and CLUSTER_NAME is the cluster name.
-
Update and verify the Kubeconfig configuration file.
Configuration Steps
Deploy AWS Load Balancer Controller
Note: For detailed information on deploying AWS Load Balancer Controller, see official documentation.
Configure OIDC Provider
Kubernetes clusters use OpenID Connect (OIDC) for identity management and are associated with an OIDC issuer URL. To enable AWS Identity in the cluster and allow IAM roles for Service Accounts, create an IAM OIDC Provider associated with the cluster's OIDC issuer URL.
Execute the following command in eksctl to configure the OIDC Provider:
Execute the following commands to create an IAM policy and create a Service Account named aws-load-balancer-controller, associating it with an IAM role:
Deploy AWS Load Balancer Controller to Cluster
Execute the following commands in eksctl to deploy AWS Load Balancer Controller:
-
Add the eks-charts repository:
-
Update the local repository:
-
Deploy the AWS Load Balancer Controller Helm Chart to the cluster:
Note:
aws-load-balancer-controlleris the Service Account created in Configure Service Account.
Create Ingress and LoadBalancer Services
You can create ingress and LoadBalancer services simultaneously or choose one based on your needs.
Create Ingress
-
In Container Platform, click Network > Ingress in the left navigation.
-
Click Create Ingress and select EKS Ingress Class for Ingress Class.
-
Select Protocol. Default is HTTP. For HTTPS, first create a certificate and select it.
-
Switch to YAML and add the following annotations. For details, see annotation documentation:
-
Click Create.
Create LoadBalancer Service
-
In Container Platform, click Network > Services in the left navigation.
-
Click Create Service and select LoadBalancer for External Access.
-
Expand annotations and fill in LoadBalancer service annotations as needed.
-
Click Create.
Related Operations
Test AWS CLI and eksctl Installation
-
Execute the following command. If it returns a cluster list, AWS CLI is correctly installed:
-
Execute the following command. If it returns a cluster list, eksctl is correctly installed:
Get ACCOUNT_ID
Execute aws sts get-caller-identity to get ACCOUNT_ID. The 651168850570 in the response is the ACCOUNT_ID:
Kubeconfig Configuration File
-
Execute the following command to update the Kubeconfig file for the specified region:
-
Execute the following command to verify the Kubeconfig file. If it returns information normally, the configuration is correct:
Add Tags to Subnets
-
Execute the following command to get cluster subnets:
-
Execute the following command to get subnet details:
-
Execute the following commands to add tags to subnets. Replace
<subnet-id>with actual values. See Subnet auto-discovery:-
Add the
kubernetes.io/role/elbtag to subnets: -
Add the
kubernetes.io/cluster/<CLUSTER_NAME>: sharedtag to shared subnets:
-
Create Certificate
When using HTTPS protocol, save HTTPS certificate credentials as a Secret (TLS type) in advance.
-
In Container Platform, click Configuration > Secrets in the left navigation.
-
Click Create Secret.
-
Select TLS type and import or fill in Certificate and Private Key as needed.
-
Click Create.