Configure access control policies for the API server
When you create a Container Service for Kubernetes (ACK) cluster, a private Classic Load Balancer (CLB) instance is automatically created as the internal endpoint of the cluster API server. Configure a whitelist or a blacklist as the access control rules for the listener on port 6443 of the private CLB instance to prevent unauthorized access to the API server.
Associate an Elastic IP Address (EIP) with the private CLB instance to create a public endpoint and enable access to the API server from the internet.
Because the public endpoint and the internal endpoint share the same private CLB instance, the access control rules configured for the instance apply to both endpoints.
Server Load Balancer (SLB) provides listener-level access control. Access control can be configured when you create a listener, and modified or reconfigured after the listener is created.
Procedure
Configure a whitelist or a blacklist for different listeners to allow access only from specific IP addresses or to block access from specific IP addresses.
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click Cluster Information.
-
On the Cluster Information page, click the Basic Information tab. In the Network section, find Internal Endpoint and click Set access control on the right. Carefully read the prompt about the CIDR blocks that the access control policy must allow, and then click OK.
-
In the panel that opens in the SLB console, turn on Access Control, select an access control method and an access control policy group, and then click OK.
Before you enable access control, you must first complete the task described in Create an ACL.
ImportantWhen you configure an access control policy, make sure that the IP addresses that you specify can access the API server. The CIDR blocks of cluster control plane components and console-related services must also be able to access the API server. Therefore, you must add the following CIDR blocks to the whitelist. Never add them to the blacklist. Otherwise, cluster features and management operations may not work as expected.
-
Container Service for Kubernetes control plane CIDR block: 100.104.0.0/16.
-
The primary CIDR block and any secondary CIDR blocks of the cluster's Virtual Private Cloud (VPC), or the CIDR blocks of the vSwitches where the cluster nodes reside.
-
The egress CIDR blocks of your clients that need to access the API server endpoint.
-
In addition to the preceding CIDR blocks, for ACK Edge cluster, you must also allow the egress CIDR blocks of edge nodes.
-
In addition to the preceding CIDR blocks, for ACK Lingjun cluster, you must also allow the Lingjun Virtual Private Datacenter (VPD) CIDR block.
-