Configuring QoS for a Pod
Scenario
Bandwidth preemption occurs between different containers deployed on the same node, which may cause service jitter. You can configure bandwidth limitation for the pod to solve this problem.
Specifications
| Specifications | Tunnel Network | VPC Network | Cloud Native Network 2.0 | VPC + DataPlane V2 | Cloud Native Network 2.0 + DataPlane V2 |
|---|---|---|---|---|---|
| Supported cluster versions | All versions | Clusters v1.19.10 and later | Clusters v1.19.10 and later | Cluster version: v1.27.16-r30, v1.28.15-r20, v1.29.13-r0, v1.30.10-r0, v1.31.6-r0, or later | Clusters v1.34.3-r10 or later |
| Egress bandwidth limitation | Supported | Supported | Supported | Supported | Supported |
| Ingress bandwidth limitation | Supported | Supported | Supported | Supported in clusters v1.28.15-r80, v1.29.15-r40, v1.30.14-r0, v1.32.9-r0, v1.33.7-r0, and later versions | Supported |
| Scenarios where bandwidth limitation is not supported | None | None |
| Mutual access between pods on the host node | None |
| Bandwidth limitation range | The value must be specified in either Mbit/s or Gbit/s, for example, 100 Mbit/s or 1 Gbit/s. The minimum allowable value is 1 Mbit/s. The maximum value is 4.29 Gbit/s for clusters running versions earlier than v1.28.15-r70, v1.29.15-r30, v1.30.14-r30, v1.31.10-r30, v1.32.6-r30, v1.33.5-r20, or v1.34.1-r0. Clusters v1.28.15-r70, v1.29.15-r30, v1.30.14-r30, v1.31.10-r30, v1.32.6-r30, v1.33.5-r20, v1.34.1-r0, and later versions: The minimum value is 1 kbit/s, and the maximum value is 1 Pbit/s. | The minimum value is 1 kbit/s, and the maximum value is 1 Pbit/s. | The minimum value is 1 kbit/s, and the maximum value is 1 Pbit/s. | ||
- eBPF-based bandwidth limiting is available only when DataPlane V2 is enabled in the VPC network. Other network models use TBF qdisc for bandwidth limiting.
- Pod bandwidth limitation applies only to regular containers. Secure containers do not support this feature.
- Pod bandwidth limitation does not apply to hostNetwork pods.
Using the CCE Console
When creating a workload on the console, you can set pod ingress and egress bandwidth limits by clicking Network Configuration in the Advanced Settings area.
Using kubectl
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
namespace: default
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
annotations:
kubernetes.io/ingress-bandwidth: 100M
kubernetes.io/egress-bandwidth: 100M
spec:
containers:
- name: container-1
image: nginx:alpine
imagePullPolicy: IfNotPresent
imagePullSecrets:
- name: default-secret - kubernetes.io/ingress-bandwidth: ingress bandwidth limit on pods
- kubernetes.io/egress-bandwidth: egress bandwidth limit on pods
If these two parameters are not specified, the bandwidth is not limited.
After modifying the ingress or egress bandwidth limit of a pod, restart the container for the modification to take effect. After annotations are modified in a pod not managed by workloads, the container will not be restarted, so the bandwidth limits do not take effect. You can create a pod again or manually restart the container.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot