The default Terway configuration meets the requirements of most scenarios. Modifying the Terway configuration is a high-risk operation that may cause errors, such as service interruptions. If you have specific requirements, such as increasing the reserved IP address resource pool to optimize pod IP address allocation, you can customize the Terway configuration by following the instructions in this topic.
Limitations
Terway provides a wide range of configuration parameters. This topic describes each parameter but does not guarantee that all parameter combinations work in all scenarios. We recommend that you thoroughly test your configuration before applying it.
Some parameters can be configured on the console. If you cannot find a parameter on the console, your current component version does not support it. In this case, you must upgrade the Terway component to configure the parameter.
Terway configuration example
The ConfigMap for the Terway component in a cluster uses the following format.
apiVersion: v1
data:
10-terway.conf: | # Terway Container Network Interface (CNI) configuration file parameters. The configuration is converted and written to /etc/cni/net.d/. Do not modify.
{
"cniVersion": "0.4.0",
"name": "terway",
"capabilities": {"bandwidth": true},
"eniip_virtual_type": "datapathv2",
"host_stack_cidrs": ["169.254.20.10/32"],
"cilium_args": "",
"type": "terway"
}
disable_network_policy: "false" # Specifies whether to disable the NetworkPolicy feature.
eni_conf: | # Main Terway configuration parameters, such as vSwitches and security groups.
{
"version": "1",
"max_pool_size": 5,
"min_pool_size": 0,
"credential_path": "/var/addon/token-config",
"enable_eni_trunking": true,
"vswitches": {"cn-hangzhou-j":["vsw-foo"],"cn-hangzhou-k":["vsw-foo"]},
"eni_tags": {"ack.aliyun.com":"c7c3cfoo"},
"service_cidr": "192.168.0.0/16",
"security_group": "sg-foo",
"ip_stack": "ipv4",
"vswitch_selection_policy": "ordered"
}
in_cluster_loadbalance: "true" # In-cluster load balancing. This parameter takes effect only in DataPathV2 or IPvlan mode.
kind: ConfigMap
metadata:
name: eni-config
namespace: kube-systemParameters
Top-level parameters
Parameter | Description | Modifiable | Configurable on console |
| Terway CNI configuration file parameters. The configuration is converted and written to | No | No |
| Custom Terway CNI configuration parameters. For more information, see Configure a custom CNI chain. | Yes | No |
| Specifies whether to disable the NetworkPolicy feature.
| Yes | Yes |
| Main Terway configuration parameters, such as vSwitches and security groups. | Yes | Partially |
| Specifies whether to enable in-cluster load balancing. This parameter takes effect only in DataPathV2 or IPvlan mode. For more information, see How do I enable in-cluster load balancing for a Terway IPvlan cluster?. | Yes | Yes |
10-terway.conf parameters
Parameter | Type | Description | Modifiable | Configurable on console |
| string | The CNI configuration version. | No | No |
| string | The name of the CNI plug-in. | No | No |
| string | The type of the CNI plug-in. | No | No |
| string | The CNI capabilities. | Yes | No |
| string | The ENI virtualization method. | No | No |
| string | The configuration parameters of Cilium. Example: Important
| Yes | Yes |
| bool | Requires terway-eniip 1.15.0 or later. Specifies whether to enable symmetric routing. If this feature is enabled, Terway configures policy-based routing rules to ensure that egress traffic uses the same network interface as ingress traffic.
| Yes | No |
| map[string]any | Requires terway-eniip 1.15.0 or later. Symmetric routing configuration parameters. The following code shows the default values and a parameter example. In most cases, you do not need to modify these parameters. Important Incorrect configurations can affect existing network settings. Thoroughly test the configuration in a test environment before use. | Yes | No |
eni_conf parameters
Parameter | Type | Description | Modifiable | Configurable on console |
| string | The Security Token Service (STS) token for accessing OpenAPI. This parameter applies only to ACK managed clusters. | No | No |
| string | The Service CIDR block of the cluster. | No | No |
| map[string][]string | The list of vSwitches used by elastic network interfaces (ENIs). | Yes | Yes |
| map[string]string | The tags to add for newly created ENIs. Modifications to this configuration do not affect existing ENIs. | No | No |
| map[string]string | Supported only in shared ENI mode. Filters the ENIs managed by Terway. For more information, see Configure a whitelist for ENIs. | Yes | No |
| int | Supported only in shared ENI mode. The maximum number of idle IP addresses maintained in the IP address resource pool. Default value: 5. | Yes | Yes |
| int | Supported only in shared ENI mode. The minimum number of idle IP addresses maintained in the IP address resource pool. Default value: 0. | Yes | Yes |
| string | The security group to use for newly created ENIs. Modifications to this configuration do not affect existing ENIs. | Yes | No |
| []string | The security groups to use for newly created ENIs. You can specify up to 10 security groups, and all security groups must be of the same type. If you configure this parameter, Terway uses the union of this list and the | Yes | Yes |
| string | The policy for selecting a vSwitch when an ENI is created.
| Yes | Yes |
| bool | Enables the elastic IP address (EIP) migration feature. For more information, see Migrate EIPs from Terway to ack-extend-network-controller. | Yes | No |
| string | The IP family of the cluster. This parameter cannot be modified. | No | No |
| string | The IPAM mode of the cluster. This parameter cannot be modified. | No | No |
| bool | Enables the | Yes | No |
| float32 | The queries per second (QPS) for the Kubernetes client. You must configure this parameter together with | Yes | Yes |
| int | The burst value for the Kubernetes client. You must configure this parameter together with | Yes | Yes |
| string | The resource group to use for newly created ENIs. Modifications to this configuration do not affect existing ENIs. | Yes | Yes |
| string | Requires terway-eniip 1.15.0 or later. Supported only in shared ENI mode. The synchronization interval of the IP address resource pool. Default value: 120 seconds. Examples: | Yes | No |
| string | Requires terway-eniip 1.16.0 or later. Supported only in shared ENI mode. The time an IP address must be idle before it can be reclaimed. Example: Note If a pod is created or deleted before the reclamation, the timer is reset. | Yes | No |
| string | Requires terway-eniip 1.16.0 or later. Supported only in shared ENI mode. The interval between reclamation checks. Example: | Yes | No |
| int | Requires terway-eniip 1.16.0 or later. Supported only in shared ENI mode. The maximum number of IP addresses that can be reclaimed per batch. The value must be in the range of [1, 10]. Example: | Yes | No |
| string | Requires terway-eniip 1.16.0 or later. Supported only in shared ENI mode. The jitter factor that is used to randomize the reclamation time. The value must be in the range of [0.0, 1.0]. Example: | Yes | No |
| int | Requires terway-eniip 1.16.4 or later and that the The number of IP addresses to pre-warm at a time. This parameter takes effect only for newly added nodes. The pre-warming task stops after the number of allocated IP addresses on the node reaches the expected value. Example: | Yes | No |
| bool | Requires terway-eniip 1.13.7 or later. Supported only in shared ENI mode. Default value: | Yes | No |
| bool | Requires terway-eniip 1.17.0 or later. Supported only in shared ENI mode. Default value: | Yes | No |
| int | Requires terway-eniip 1.17.0 or later. Supported only in shared ENI mode. This parameter is valid in IPv4 single-stack and dual-stack modes. In dual-stack mode, this parameter is ignored because IPv6 prefixes are automatically managed by the system, with one prefix per ENI. The number of IP prefixes configured for the node. This parameter is valid when the cluster network type is | Yes | No |
| int | Requires terway-eniip 1.17.0 or later. Supported only in shared ENI mode. The total number of IPv6 prefixes on the node. This parameter is valid only in IPv6 single-stack mode. The value must be 0 or 1. In dual-stack mode, this parameter is ignored because IPv6 prefixes are automatically managed by the system, with one prefix per ENI. The number of IP prefixes configured for the node. This parameter is valid when the cluster network type is | Yes | No |
Configuration methods
Console
You can configure some common parameters on the console. The console validates your input and prevents invalid formats.
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the name of your cluster. In the left navigation pane, click Add-ons.
Click the Networking tab, and then click Configuration on the terway-eniip card.
In the panel that appears, configure the parameters and then click OK.
kubectl
Some parameters are not displayed on the console. You can use kubectl to configure these parameters.
Configuring Terway by using kubectl is a high-risk operation. kubectl does not validate input, and incorrect parameters can cause errors, such as preventing Terway from running. Ensure you fully understand the configuration before modifying it.
Connect to a cluster by using kubectl and run the following command to configure advanced parameters:
kubectl edit cm -n kube-system eni-configAfter editing the configuration, save your changes and exit the editor. Then, run the following command to apply the changes:
kubectl rollout restart -n kube-system daemonset.apps/terway-eniip
Related documents
To upgrade Terway, see Manage components.
For more information about how to manage a ConfigMap, see Manage ConfigMaps.