Configure per-node network settings in a Terway cluster

Updated at:

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), so different nodes can use different vSwitches and security groups.

Use cases

Configure per-node network settings when:

  • Egress IP isolation: Specific pods need dedicated NAT IP addresses and 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. Inclusive ENI mode (default): terway-eniip version >= v1.0.10.237. Exclusive ENI mode: terway-eniip version >= v1.14.5. For configuration steps, see Configure exclusive ENI mode for a node pool.

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

  • Security group limit. Terway applies all security groups listed in both security_group and security_groups. The total cannot exceed 10. 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. If you do not need to change the vSwitches, omit the vswitches key.
    security_group To assign a single security group, set this parameter and leave security_groups as null. If you do not need to change the security groups, omit the security_group and security_groups keys.
    security_groups To assign multiple security groups, set this parameter and leave security_group as null. If you do not need to change the security groups, omit the security_group and security_groups keys.
  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 vSwitch and security group settings take effect once the recreated Terway 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 the configuration does not take effect, see FAQ about container networks.