All Products
Search
Document Center

Limit the bandwidth of an elastic container instance

Last Updated: May 21, 2021

Elastic Container Instance allows you to configure the network bandwidth values for inbound and outbound traffic. This topic describes how to limit the inbound and outbound bandwidth of an elastic container instance.

Kubernetes mode

When you use Kubernetes to create an elastic container instance, you can add annotations to a pod to specify the maximum inbound and outbound bandwidth values. Take note of the following items:

  • kubernetes.io/ingress-bandwidth: the inbound bandwidth.

  • kubernetes.io/egress-bandwidth: the outbound bandwidth.

Supported units include GB, G, MB, M, KB, K, and B. If the unit is not specified, B is used by default, which indicates bytes.

apiVersion: v1
kind: Pod
metadata:
  name: eci-qos
  annotations:
    kubernetes.io/ingress-bandwidth: 40M    #Inbound bandwidth
    kubernetes.io/egress-bandwidth: 10M    #Outbound bandwidth
spec:
  containers:
  - name: nginx
    image: nginx:latest
    command: ["bash","-c","sleep 100000"]

API mode

When you use the CreateContainerGroup operation to create an elastic container instance, you can use the CreateContainerGroup and IngressBandwidth parameters to specify the maximum inbound and outbound bandwidth values. The following table describes the parameters. For more information, see CreateContainerGroup.

Parameter

Type

Required

Example

Description

IngressBandwidth

Long

No

102400

The inbound bandwidth. Unit: bytes.

EgressBandwidth

Long

No

102400

The outbound bandwidth. Unit: bytes.