In ENS edge scenarios, if an ACK Edge cluster uses the Terway Edge plugin, when the vSwitch runs out of IP addresses or the pod network segment needs to be expanded, you can add a new pod vSwitch to increase the IP address resources for the ACK Edge cluster.
Prerequisites
-
Your ACK Edge cluster uses the Terway Edge network plugin.
-
You use ENS for your edge nodes.
Add a vSwitch
If you determine that your pod vSwitch has insufficient IP addresses, follow these steps to add a new vSwitch for your ACK Edge cluster.
-
Create a vSwitch in the corresponding ENS network.
-
Log on to the ENS console. In the left-side navigation pane, choose Networking > vSwitch.
-
On the vSwitch page, click Create vSwitch, fill in the required information, and then click Create.
Nodes: Select the ENS node.
Network: Select the corresponding ENS network.
Name: Enter a name for the new vSwitch.
IPv4 CIDR Block: Specify an IPv4 CIDR block that is within the range of the ENS network.
-
-
Add the new vSwitch to the Terway Edge ConfigMap.
kubectl edit cm privateip-config -n kube-systemIn the following example, add the new vSwitch under
vswitches.n-xxxis a placeholder for the network ID in ENS, and["vsw-xxx", "vsw-xxxx"]is a list of vSwitch IDs within that network. You can specify multiple IDs. Do not remove any existing vSwitch IDs.apiVersion: v1 kind: ConfigMap metadata: annotations: helm.sh/hook: pre-install name: privateip-config namespace: kube-system data: privateip_conf: | { "vswitches": { "n-network1": ["vsw-switch1", "vsw-switch2"], "n-network2": ["vsw-switch3", "vsw-switch4"] }, "vswitch_selection_policy": "most" }NoteBy default, pod IP addresses are allocated from the vSwitch that contains the provisioned elastic network interface (ENI). The new pod vSwitch does not need to be the same vSwitch that your ENS instances or ENIs use.
Diagnose IP shortage
If you use the Terway Edge network and notice that pods fail to create with a ContainerCreating status, follow these steps to determine if the cause is insufficient IP addresses in the vSwitch.
-
Check the ENS node where the pod is scheduled.
kubectl get pod -o wideExample output:
NAME READY STATUS RESTARTS AGE IP NODE cube-1 0/1 ContainerCreating 0 41s <none> node-1 cube-2 0/1 ContainerCreating 0 41s <none> node-1 -
Check the resource information of the ENS node.
kubectl describe ensnodes node-1Example output:
Name: node-1 Namespace: Labels: name=node-1 API Version: network.alibabacloud.com/v1beta1 .... Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning AllocIPFailed 1m ens-multi-ip-node [SDKError] API: AssignPrivateIpAddresses, ErrorCode: InvalidVSwitchId.IpNotEnough, RequestId: xxxxxxx, Message: Don't have enough private IPs in this switch. Warning AllocIPFailed 1m ens-multi-ip-node [SDKError] API: AssignPrivateIpAddresses, ErrorCode: InvalidVSwitchId.IpNotEnough, RequestId: xxxxxxx, Message: Don't have enough private IPs in this switch.The
ErrorCode: InvalidVSwitchId.IpNotEnougherror in the Events output confirms that the pod vSwitch has run out of IP addresses.