Set per-pod bandwidth limits to enforce Quality of Service (QoS), improve network stability, and tighten security.
How it works
Add kubernetes.io/ingress-bandwidth and kubernetes.io/egress-bandwidth annotations to the pod metadata in your workload manifest. ECI reads these annotations at pod creation time and applies the corresponding bandwidth limits.
Prerequisites
Before you begin, ensure that you have:
An Elastic Container Instance (ECI)-based pod or workload to configure
Permission to create or deploy workloads in your cluster
Set bandwidth limits
Add the following annotations to the pod metadata:
| Annotation | Description |
|---|---|
kubernetes.io/ingress-bandwidth | Maximum inbound bandwidth |
kubernetes.io/egress-bandwidth | Maximum outbound bandwidth |
Supported units: TB, T, GB, G, MB, M, KB, K, B. If no unit is specified, B (bytes) is used by default.
The annotation value represents bytes per second. The system converts it to the equivalent bit-rate. For example:
| Annotation value | Actual bandwidth |
|---|---|
40M | 320 Mbit/s |
10M | 80 Mbit/s |
Example: Deployment with bandwidth limits
For a Deployment, add the annotations in the spec.template.metadata section:
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:
kubernetes.io/ingress-bandwidth: 40M # Limit the inbound bandwidth of the pod.
kubernetes.io/egress-bandwidth: 10M # Limit the outbound bandwidth of the pod.
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80Usage notes
Annotations must be in the pod
metadata, not the top-level workloadmetadata. For a Deployment, this isspec.template.metadata.Bandwidth annotations only take effect when a pod is created. Adding or modifying annotations on an existing pod has no effect.