Elastic Container Instance (ECI) supports both IPv4 and IPv6. To assign an IPv6 address to an ECI pod in a Kubernetes cluster, add the required annotation to the pod's metadata section.
Limitations
Each elastic container instance supports one IPv6 address.
ECI instances sized by vCPU and memory all support IPv6.
ECI instances sized by Elastic Compute Service (ECS) instance type require the selected instance type to support IPv6. To check compatibility, see Overview of instance families and filter by IPv6 support.
Prerequisites
Before you begin, ensure that you have:
IPv6 enabled on the VPC and vSwitch — The virtual private cloud (VPC) where the instance runs and the vSwitch it connects to must both have IPv6 CIDR blocks enabled. See Enable IPv6 for a VPC. Then follow the same steps to enable IPv6 for the vSwitch.
(Optional) An IPv6 gateway — After you enable IPv6 for a VPC, the system automatically creates a Free Edition IPv6 gateway. Create an Enterprise Edition or Enhanced Enterprise Edition gateway only if your traffic volume requires higher capacity. See Create and manage an IPv6 gateway.
(Optional) IPv6 Internet bandwidth enabled — Required only if the pod needs to communicate over the Internet using its IPv6 address. See Enable and manage IPv6 Internet bandwidth.
Assign an IPv6 address
Add annotations to the pod's metadata section to assign an IPv6 address and, optionally, enable IPv6 Internet access.
Annotations must be placed in the pod's metadata section. For a Deployment, this is spec.template.metadata, not the top-level metadata. Annotations take effect only when the pod is created — updating annotations on an existing pod has no effect.
The following annotations are available:
| Annotation | Required | Example value | Default | Description |
|---|---|---|---|---|
k8s.aliyun.com/eci-enable-ipv6 | Yes | "true" | — | Assigns an IPv6 address to the pod. |
k8s.aliyun.com/eci-ipv6-bandwidth-enable | No | "true" | — | Enables Internet access over the IPv6 address. |
k8s.aliyun.com/eci-ipv6-bandwidth | No | 200 | Maximum bandwidth supported by the IPv6 gateway | Sets the peak Internet bandwidth (Mbit/s). Valid range: 1–2,000 Mbit/s for pay-by-bandwidth; 1–1,000 Mbit/s for pay-by-traffic. |
Example Deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx-test
labels:
app: nginx
alibabacloud.com/eci: "true"
annotations:
k8s.aliyun.com/eci-enable-ipv6: "true" # Assigns an IPv6 address to the pod
k8s.aliyun.com/eci-ipv6-bandwidth-enable: "true" # Enables Internet access over IPv6
k8s.aliyun.com/eci-ipv6-bandwidth: 100M # Sets peak bandwidth to 100 Mbit/s
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80What's next
To learn about IPv6 gateway editions and bandwidth billing, see What is an IPv6 gateway?