tencent cloud

Tencent Kubernetes Engine

DocumentaçãoTencent Kubernetes EngineUse CasesContainerizationAccelerated Pull of Images Outside the Chinese Mainland

Accelerated Pull of Images Outside the Chinese Mainland

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-11-30 14:15:15
Traduzido e Verificado por IA

Scenarios

Currently, most container images for open source applications (such as Kubernetes and TensorFlow) are hosted on overseas image hosting platforms (such as DockerHub and quay.io). When pulling these images in China, you may encounter network issues that cause slow pull speeds or even complete pull failures. A common workaround is to manually pull the images to a local environment and then Push them to a self-built image repository for manual synchronization. However, this process is extremely tedious and cannot cover all repositories or the latest image versions. Tencent Cloud TCR Enterprise Edition provides acceleration services for mainstream overseas image hosting platforms, effectively resolving deployment failures of open source applications caused by difficulties in pulling overseas images. This document describes how a TKE cluster can accelerate overseas image pulls through the TCR acceleration service.

Limits

The acceleration service is currently available only to TKE and TCR users.
The acceleration service currently supports access only from Tencent Cloud VPC. Public network access is not yet available. Related domains can be accessed but cannot provide actual acceleration.

Operation Steps

For TKE clusters, acceleration is enabled by default for public images on DockerHub (docker.io). To accelerate image repositories on other platforms, such as quay.io, you need to perform additional configuration. The configuration methods vary depending on whether the cluster runtime is Docker or Containerd.
Configuring Clusters with Docker Runtime
Configuring Clusters with Containerd Runtime
For nodes running Docker, Docker itself does not support acceleration configuration for registries other than docker.io. When using overseas container images from registries other than docker.io, run the following command to change the image address domain by replacing quay.io with quay.tencentcloudcr.com. Example:
docker pull quay.tencentcloudcr.com/k8scsi/csi-resizer:v0.5.0

For long-term and stable use of overseas image acceleration, configure the Docker daemon configuration file to achieve persistence and avoid manually replacing the image address each time. For Linux instances, perform the following steps:
1. Run the following command to open the /etc/docker/daemon.json configuration file.
vim /etc/docker/daemon.json
2. Press i to switch to edit mode, add the following content, and save.
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com"
]
}
3. Run the following command to restart Docker. The example command uses CentOS 7.
Attention:
Restarting an instance may cause severe consequences such as service interruption and data loss. Follow standard Ops procedures, check the application status and data backup before the operation, and perform the operation during off-peak hours.
sudo systemctl restart docker
4. After restarting Docker, run the following command to view the current Docker configuration. If the image source is configured successfully, the output will contain the section shown in the following figure.
Note:
You can also directly run the docker pull <image name> command to pull the image. If the image is pulled successfully, the configuration is successful.
sudo docker info


For nodes running Containerd, you can modify the Containerd configuration to automatically accelerate image pulling without changing image addresses, because Containerd supports acceleration address configuration for any image registry. This is suitable for scenarios with a large number of overseas images and reduces the tedious steps of extensive address modifications.
1. When adding nodes to TKE or using node pools, you can write nodes into a custom script. Through the script, you can uniformly modify the Containerd configuration of incremental nodes and add acceleration addresses for overseas images. The following is a script example:
sed -i '/\\[plugins\\.cri\\.registry\\.mirrors\\]/a\\
[plugins.cri.registry.mirrors."quay.io"]\\
endpoint = ["https://quay.tencentcloudcr.com"]
' /etc/containerd/config.toml
Alternatively, manually modify the Containerd configuration of existing nodes (/etc/containerd/config.toml) and add a configuration similar to the following:
[plugins.cri.registry]
[plugins.cri.registry.mirrors]
[plugins.cri.registry.mirrors."quay.io"]
endpoint = ["https://quay.tencentcloudcr.com"]
[plugins.cri.registry.mirrors."docker.io"]
endpoint = ["https://mirror.ccs.tencentyun.com"]
[plugins.cri.registry.mirrors."nvcr.io"]
endpoint = ["https://nvcr.tencentcloudcr.com"]
[plugins.cri.registry.mirrors."gcr.io"]
endpoint = ["https://gcr.tencentcloudcr.com"]
[plugins.cri.registry.mirrors."k8s.gcr.io"]
endpoint = ["https://k8s.tencentcloudcr.com"]


Note
You can also use Ansible to modify the Containerd configuration of existing nodes in batches. For details, see Using Ansible to Operate TKE Nodes in Batches.
2. Run the following command to restart Containerd. The following is an example:
Attention:
Restarting an instance may cause severe consequences such as service interruption and data loss. Follow standard Ops procedures, check the application status and data backup before the operation, and perform the operation during off-peak hours.
systemctl restart containerd

3. Run the following command to pull the image using the original image address. The following is an example:
crictl pull quay.io/k8scsi/csi-resizer:v0.5.0



Ajuda e Suporte

Esta página foi útil?

comentários