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.
Prerequisites
Ensure you have:
-
vSwitches to assign to nodes are created.
-
Security groups to assign to nodes are created.
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.
-
Log on to the ACK console. In the left-side navigation pane, click Clusters.
-
On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose Configurations > ConfigMaps.
-
On the ConfigMap page, select kube-system from the Namespace drop-down list, then click Create.
-
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
vswitchesandsecurity_groupwith 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 vswitchesA 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_groupTo assign a single security group, set this parameter and leave security_groupsas null.security_groupsTo assign multiple security groups, set this parameter and leave security_groupas null. To assign multiple security groups, set this parameter and leave security_group as null. -
Click OK.
Step 2: Label nodes
Apply the label terway-config=foo to the nodes that should use this ConfigMap.
For existing nodes:
-
In the left-side navigation pane of the cluster details page, choose Nodes > Nodes. Click Manage Labels and Taints.
-
On the Labels tab, select the target nodes and click Add Label.
-
In the Add dialog, set Name to terway-config and Value to foo, then click OK.
-
Restart the Terway pods to apply the change.
-
In the left-side navigation pane, choose Workloads > Pods.
-
Select kube-system from the Namespace drop-down list, search for
terway-eniip, select all matching pods, and click Batch Delete. -
Click OK. Kubernetes recreates the Terway pods.
-
Wait until the Status column shows Running for all
terway-eniippods. 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.
-
Log on to the ECS console. In the left-side navigation pane, choose Instances & Images > Instances.
-
Click the name of the target ECS instance. On the details page, click the ENIs tab.
-
Verify that the ENI used for pod IP allocation is associated with the vSwitches and security groups from the ConfigMap.
If a new pod's IP address is not within the expected vSwitch CIDR block, see FAQ about container networks.