Add a pod vSwitch

更新时间:
复制 MD 格式

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

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.

  1. Create a vSwitch in the corresponding ENS network.

    1. Log on to the ENS console. In the left-side navigation pane, choose Networking > vSwitch.

    2. 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.

  2. Add the new vSwitch to the Terway Edge ConfigMap.

    kubectl edit cm privateip-config -n kube-system 

    In the following example, add the new vSwitch under vswitches. n-xxx is 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"
        }
    
    Note

    By 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.

  1. Check the ENS node where the pod is scheduled.

    kubectl get pod -o wide 

    Example 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  
  2. Check the resource information of the ENS node.

    kubectl describe ensnodes node-1

    Example 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.IpNotEnough error in the Events output confirms that the pod vSwitch has run out of IP addresses.

Related documents