排查容器网络接口下载失败问题

本文讨论如何识别和解决CniDownloadTimeoutVMExtensionError错误代码(也称为ERR_CNI_DOWNLOAD_TIMEOUT错误代码、错误代码 41)或WINDOWS_CSE_ERROR_DOWNLOAD_CNI_PACKAGE尝试创建和部署Microsoft Azure Kubernetes 服务(AKS)群集时发生的错误代码(错误代码 35)。

先决条件

  • Curl 命令行工具
  • 需要从将 AKS 节点部署到的同一环境中进行网络访问(相同的 VNet、防火墙规则等)

现象

尝试创建基于 Linux 的 AKS 群集时,会收到以下错误消息:

Message: We are unable to serve this request due to an internal error
SubCode: CniDownloadTimeoutVMExtensionError;
Message="VM has reported a failure when processing extension 'vmssCSE'.
Error message: "Enable failed: failed to execute command: command terminated with exit status=41\n[stdout]\n{
"ExitCode": "41",

尝试创建基于 Windows 的 AKS 群集时,会收到以下错误消息:

Message="VM has reported a failure when processing extension 'vmssCSE' (publisher 'Microsoft.Compute' and type 'CustomScriptExtension').
Error message: 'Command execution finished, but failed because it returned a non-zero exit code of: '1'. The command had an error output of: 'ExitCode: |35|,
Output: |WINDOWS_CSE_ERROR_DOWNLOAD_CNI_PACKAGE|, Error: |Failed in downloading \r\nhttps://acs-mirror.azureedge.net/azure-cni/v1.4.56/binaries/azure-vnet-cni-overlay-windows-amd64-v1.4.56.zip.
Error: \r\nUnable to connect to the r|\r\nAt line:1 ...'
For more information, check the instance view by executing Get-AzVmssVm or Get-AzVm (https://aka.ms/GetAzVm). These commands can be executed using CloudShell (https://aka.ms/CloudShell)'. More information on troubleshooting is available at https://aka.ms/VMExtensionCSEWindowsTroubleshoot.

原因

群集节点无法连接到用于下载容器网络接口(CNI)库的终结点。 在大多数情况下,此问题发生的原因是网络虚拟设备正在阻止安全套接字层(SSL)通信或 SSL 证书。

解决方案

运行 Curl 命令,验证节点是否可以下载二进制文件:

首先,尝试从官方镜像终结点下载适用于 Linux 的 Azure CNI 包。

curl -I https://acs-mirror.azureedge.net/cni/azure-vnet-cni-linux-amd64-v1.0.25.tgz

结果:

HTTP/2 200 
content-length: 970752
content-type: application/x-gzip
last-modified: Wed, 22 Jun 2022 00:00:00 GMT
etag: "0x8DA53F1234567"
server: ECAcc (dab/4B9E)
x-cache: HIT
cache-control: public, max-age=86400
accept-ranges: bytes
date: Thu, 05 Jun 2025 00:00:00 GMT

此命令检查终结点是否可访问并返回 HTTP 标头。 如果看到 200 OK 响应,则表示终结点可访问。

接下来,尝试使用验证进行下载,并将文件保存在本地,以便进一步进行故障排除。 这有助于确定是否已正确配置 SSL 或出站连接。

# Create a temporary directory for testing
mkdir -p /tmp/cni-test

# Download the CNI package to the temp directory
curl -L --fail https://acs-mirror.azureedge.net/cni/azure-vnet-cni-linux-amd64-v1.0.25.tgz --output /tmp/cni-test/azure-vnet-cni-linux-amd64-v1.0.25.tgz && echo "Download successful" || echo "Download failed"

结果:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6495k  100 6495k    0     0  8234k      0 --:--:-- --:--:-- --:--:-- 8230k
Download successful

验证下载的文件:

ls -la /tmp/cni-test/
file /tmp/cni-test/azure-vnet-cni-linux-amd64-v1.0.25.tgz

结果:

total 6500
drwxr-xr-x 2 user user    4096 Jun 20 10:30 .
drwxrwxrwt 8 root root    4096 Jun 20 10:30 ..
-rw-r--r-- 1 user user 6651392 Jun 20 10:30 azure-vnet-cni-linux-amd64-v1.0.25.tgz

/tmp/cni-test/azure-vnet-cni-linux-amd64-v1.0.25.tgz: gzip compressed data, from Unix, original size modulo 2^32 20070400

清理测试文件:

rm -rf /tmp/cni-test/

如果无法下载这些文件,请确保允许将流量发送到下载终结点。 有关详细信息,请参阅 Azure 全局所需的 FQDN/应用程序规则

参考

联系我们寻求帮助

如果有疑问,可以询问 Azure 社区支持。 你还可以将产品反馈提交到 Azure 反馈社区