All Products
Search
Document Center

Container Service for Kubernetes:Configure per-node network settings in a Terway cluster

Last Updated:Jun 23, 2026

By default, Terway nodes use the eni-config ConfigMap in the kube-system namespace. To assign custom vSwitches and security groups per node, create a dedicated ConfigMap. Terway merges it into the default configuration using MergePatch (RFC 7396).

Use cases

Configure per-node network settings when:

  • Egress IP isolation: Specific pods need dedicated NAT IP addresses or bandwidth limits, separate from the rest of the cluster.

image

Prerequisites

Ensure you have:

Considerations

  • Existing elastic network interfaces (ENIs) are not updated automatically. Only ENIs created after the configuration change use the new vSwitches and security groups. Shared ENI mode (default): terway-eniip version >= v1.0.10.237. Exclusive ENI mode: terway-eniip version >= v1.14.5.

  • vSwitches must be in the same zone as the node. A vSwitch in a different zone has no effect.

  • Security group limit. Assign up to 10 security groups per ENI. All must be in the same VPC and of the same type. See Associate multiple security groups for an ENI.

Configure per-node network settings

Create a ConfigMap with the desired network settings, label the target nodes to reference it, then verify that new ENIs use the correct settings.

Step 1: Create a ConfigMap

Create a ConfigMap named foo in the kube-system namespace to define vSwitches and security groups for labeled nodes.

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose Configurations > ConfigMaps.

  3. On the ConfigMap page, select kube-system from the Namespace drop-down list, then click Create.

  4. In the Create panel, set ConfigMap Name to foo. Click Add, set Name to eni_conf, and enter the following JSON as the Value. Replace vswitches and security_group with your actual IDs.

    {
        "vswitches": {
            "cn-hangzhou-g": [
                "vsw-10000"
            ],
            "cn-hangzhou-i": [
                "vsw-10001"
            ]
        },
        "security_group": "sg-10000",
        "security_groups": [
            "sg-10000",
            "sg-10001"
        ]
    }
    Parameter Description
    vswitches A map of zone IDs to vSwitch ID lists. Each vSwitch must be in the same zone as the target nodes. Find zone and vSwitch IDs in the VPC console under vSwitch.
    security_group To assign a single security group, set this parameter and leave security_groups as null.
    security_groups To assign multiple security groups, set this parameter and leave security_group as null. To assign multiple security groups, set this parameter and leave security_group as null.
  5. Click OK.

Step 2: Label nodes

Apply the label terway-config=foo to the nodes that should use this ConfigMap.

For existing nodes:

  1. In the left-side navigation pane of the cluster details page, choose Nodes > Nodes. Click Manage Labels and Taints.

  2. On the Labels tab, select the target nodes and click Add Label.

  3. In the Add dialog, set Name to terway-config and Value to foo, then click OK.

  4. Restart the Terway pods to apply the change.

    1. In the left-side navigation pane, choose Workloads > Pods.

    2. Select kube-system from the Namespace drop-down list, search for terway-eniip, select all matching pods, and click Batch Delete.

    3. Click OK. Kubernetes recreates the Terway pods.

    4. Wait until the Status column shows Running for all terway-eniip pods. The new settings take effect after all pods are running.

For new nodes:

When creating a node pool, add a label with key set to terway-config and value set to foo.

Step 3: Verify the configuration

After the Terway pods restart, verify that new ENIs use the correct vSwitches and security groups.

  1. Log on to the ECS console. In the left-side navigation pane, choose Instances & Images > Instances.

  2. Click the name of the target ECS instance. On the details page, click the ENIs tab.

  3. Verify that the ENI used for pod IP allocation is associated with the vSwitches and security groups from the ConfigMap.

Note

If a new pod's IP address is not within the expected vSwitch CIDR block, see FAQ about container networks.