CCE P2P Accelerator Description
Prerequisites
- Create an enterprise instance of Cloud Container Registry (CCR). The specification of the created enterprise instance must be either Standard or Advanced. For specific operations, please refer to Create an Enterprise Instance.
-
Create a K8S Cluster CCE with the following specific configurations. For specific operations, please refer to [Create a Cluster](CCE/Operation guide/Cluster management/Create cluster.md).
- The cluster must be running Kubernetes version 1.18 or higher.
- Clusters with ARM architecture are not supported.
- Configure virtual private cloud access control in the Cloud Container Registry (CCR) enterprise instance. For specific operations, please refer to Configure Virtual Private Cloud Access Control. The virtual private cloud selected when configuring the CCR enterprise virtual private cloud control corresponds to the virtual private cloud where the CCE cluster is located. To query the virtual private cloud of the K8S Cluster CCE, please refer to [View Cluster](CCE/Operation guide/Cluster management/View Cluster.md).
Applicable scenarios
When large-scale container clusters download images in bulk, the network bandwidth of container image storage can become a bottleneck, causing slow image pulls. The P2P acceleration feature leverages the bandwidth resources of compute nodes within the cluster to distribute images between nodes, reducing the load on container image storage, significantly speeding up image pulls, and shortening the time required for application deployment.
Component introduction
The CCE P2P Accelerate component enables container image P2P acceleration. Users can deploy this component in the Cloud Container Engine K8S Cluster CCE to leverage the bandwidth resources of cluster compute nodes for distributing images between nodes, speeding up image pulls during service deployment or updates.
Limitations
- Kubernetes clusters supported are v1.18 and above, with no support for ARM architecture clusters.
Install component
- Sign in to the Baidu AI Cloud Official Website and enter the management console.
- Select Product Services > Cloud Native > Cloud Container Engine (CCE) to enter the CCE management console.
- Click Cluster Management > Cluster List in the left navigation bar.
- Click on the target cluster name in the Cluster List page to navigate to the cluster management page.
- Select O&M & Management in the left sidebar, click Component Management, and switch the tab to Image.
- Select the CCE P2P Accelerater component from the component management list and click Install

- Enter the CCR instance ID, bandwidth rate limiting and port, then click the OK button to complete the component installation.

Enable P2P acceleration
K8S Cluster CCE enables P2P by adding labels to containers or namespaces. You can choose the appropriate method according to your actual needs:
Note: The label name is
cce.baidubce.com/p2p-accelerate, and the value istrue.
-
Add image acceleration labels to Pods individually, such as for Deployment or DaemonSet.
Note:To effectively enable the P2P function, the P2P label for the container must be added under spec.template.metadata.labels of the workload.
- Alternatively, set a label for a namespace within the Kubernetes cluster under CCE. Any workload in the labeled namespace that meets acceleration criteria will automatically activate on-demand image loading, eliminating the need to modify its YAML file.
Once P2P acceleration is enabled, the acceleration component will automatically add necessary annotations, P2P image addresses, and corresponding image pull credentials to the Pod (only the image registry address differs, while the image pull credentials remain unchanged).
P2P acceleration examples
- Add the label cce.baidubce.com/p2p-accelerate:true to the template of the deployment file
1apiVersion: apps/v1
2kind: Deployment
3metadata:
4 name: deployment-example
5 labels:
6 app: nginx
7spec:
8 replicas: 2
9 selector:
10 matchLabels:
11 app: nginx
12 template:
13 metadata:
14 labels:
15 app: nginx
16 cce.baidubce.com/p2p-accelerate: "true" # Enable P2P acceleration
17 spec:
18 containers:
19 - name: nginx
20 image: ccr-1xgztest-vpc.cnc.gz.baidubce.com/eccr-qa-private/nginx:1.22.0
21 imagePullSecrets:
22 - name:test-registry
- If the Pod in the deployment has been injected with P2P-related annotations, P2P acceleration image address and corresponding image pull credentials, it indicates that P2P acceleration is enabled successfully
1apiVersion: v1
2kind: Pod
3metadata:
4 annotations:
5 cce.baidubce.com/p2p-accelerate: "true" # Enable P2P acceleration
6spec:
7 containers:
8 - image: ccr-1xgztest-vpc-p2p.cnc.gz.baidubce.com:60001/eccr-qa-private/nginx:1.22.0 Container image address after #P2P proxy
9 imagePullSecrets:
10 - name: test-registry
Component function
- cce-p2p-accelerator: Use the label cce.baidubce.com/p2p-accelerate from the namespace or workload to determine if P2P image acceleration should be enabled. If set to true, update the image address to a P2P address.
- cce-p2p-accelerator-dragonfly-dfdaemon: A daemon supporting image operations provides task downloading capabilities.
Deployment status
When the CCE P2P Accelerate component is installed, the following objects will be deployed in the Kubernetes cluster:
| Object name | Belonging to namespace | Resource usage | Types |
|---|---|---|---|
| cce-p2p-accelerator | kube-system | - | Deployment |
| dragonfly-dfdaemon | kube-system | - | DaemonSet |
| cce-p2p-accelerator | kube-system | - | ServiceAccount |
| cce-p2p-accelerator | kube-system | - | Secret |
| cce-p2p-accelerator | kube-system | - | ConfigMap |
| dragonfly-dfdaemon | kube-system | - | ConfigMap |
| cce-p2p-accelerator | kube-system | - | ConfigMap |
| cce-p2p-accelerator | - | - | ClusterRole |
| cce-p2p-accelerator | - | - | ClusterRoleBinding |
| cce-p2p-accelerator | kube-system | - | ServiceAccount |
| cce-p2p-accelerator | kube-system | - | Service |
| cce-p2p-accelerator | kube-system | - | MutatingWebhookConfiguration |
Support annotations
| Parameter name | Types | Description | Example |
|---|---|---|---|
| cce.baidubce.com/p2p-accelerate | string | Whether to enable P2P image acceleration | "true" |
Version records
| Version No. | Cluster version compatibility | Update time | Update content | Impact |
|---|---|---|---|---|
| 1.1.1 | CCE/v1.18+ | 2024.04.11 | Optimize the scheduler deployment architecture to improve P2P seed acquisition efficiency | - |
| 1.0.1 | CCE/v1.18+ | 2023.03.21 | First release | - |
