針對 OutboundConnFailVMExtensionError 錯誤碼 (50) 進行疑難解答

本文說明如何識別及解決OutboundConnFailVMExtensionError錯誤 (也稱為錯誤碼 ERR_OUTBOUND_CONN_FAIL,如果您嘗試啟動或建立及部署 Microsoft Azure Kubernetes Service (AKS) 叢集,可能會發生錯誤編號 50) 。

必要條件

  • Netcat (nc) 命令行工具

  • dig 命令行工具

  • 用戶端 URL (cURL) 工具

徵狀

當您嘗試啟動或建立 AKS 叢集時,您會收到下列錯誤訊息:

無法從代理程式建立輸出連線,請參閱 https://aka.ms/aks-required-ports-and-addresses 以取得詳細資訊。

詳細數據:Code=“VMExtensionProvisioningError”

Message=“VM 在處理擴充功能 'vmssCSE' 時回報失敗。

錯誤訊息:「啟用失敗:無法執行命令:命令已終止,結束狀態=50\n[stdout]\n\n[stderr]\nnc:連線到 mcr.microsoft.com 埠 443 (tcp) 失敗:聯機逾時\n命令已結束,狀態為非零

錯誤詳細數據:“vmssCSE 錯誤訊息: {vmssCSE exit status=50, output=pt/apt.conf.d/95proxy...}

原因

下載必要元件以布建節點的自定義腳本擴充功能無法建立取得套件所需的輸出連線能力。 針對公用叢集,節點會嘗試與埠 443 上的 Microsoft Container Registry (MCR) 端點 (mcr.microsoft.com) 通訊。

流量可能遭到封鎖的原因有很多。 在這些情況下,測試連線的最佳方式是使用安全殼層通訊協定 (SSH) 來連線到節點。 若要建立連線,請遵循連線到 Azure Kubernetes Service (AKS) 叢集節點中的指示進行維護或疑難解答。 然後,遵循下列步驟來測試叢集上的連線能力:

  1. 線上到節點之後,請執行 ncdig 命令:

    nc -vz mcr.microsoft.com 443 
    dig mcr.microsoft.com 443
    

    注意事項

    如果您無法透過 SSH 存取節點,您可以對虛擬機擴展集實例執行 az vmss run-command invoke 命令 來測試輸出連線能力:

    # Get the VMSS instance IDs.
    az vmss list-instances --resource-group <mc-resource-group-name> \
        --name <vmss-name> \
        --output table
    
    # Use an instance ID to test outbound connectivity.
    az vmss run-command invoke --resource-group <mc-resource-group-name> \
        --name <vmss-name> \
        --command-id RunShellScript \
        --instance-id <vmss-instance-id> \
        --output json \
        --scripts "nc -vz mcr.microsoft.com 443"
    
  2. 如果您嘗試使用 HTTP Proxy 建立 AKS 叢集,請在 nc連線到節點之後執行、 curldig 命令:

    # Test connectivity to the HTTP proxy server from the AKS node.
    nc -vz <http-s-proxy-address> <port>
    
    # Test traffic from the HTTP proxy server to HTTPS.
    curl --proxy http://<http-proxy-address>:<port>/ --head https://mcr.microsoft.com
    
    # Test traffic from the HTTPS proxy server to HTTPS.
    curl --proxy https://<https-proxy-address>:<port>/ --head https://mcr.microsoft.com
    
    # Test DNS functionality.
    dig mcr.microsoft.com 443
    

    注意事項

    如果您無法透過 SSH 存取節點,您可以針對虛擬機擴展集實例執行 az vmss run-command invoke 命令來測試輸出連線能力:

    # Get the VMSS instance IDs.
    az vmss list-instances --resource-group <mc-resource-group-name> \
        --name <vmss-name> \
        --output table
    
    # Use an instance ID to test connectivity from the HTTP proxy server to HTTPS.
    az vmss run-command invoke --resource-group <mc-resource-group-name> \
        --name <vmss-name> \
        --command-id RunShellScript \
        --instance-id <vmss-instance-id> \
        --output json \
        --scripts "curl --proxy http://<http-proxy-address>:<port>/ --head https://mcr.microsoft.com"
    
    # Use an instance ID to test connectivity from the HTTPS proxy server to HTTPS.
    az vmss run-command invoke --resource-group <mc-resource-group-name> \
        --name <vmss-name> \
        --command-id RunShellScript \
        --instance-id <vmss-instance-id> \
        --output json \
        --scripts "curl --proxy https://<https-proxy-address>:<port>/ --head https://mcr.microsoft.com"
    
    # Use an instance ID to test DNS functionality.
    az vmss run-command invoke --resource-group <mc-resource-group-name> \
        --name <vmss-name> \
        --command-id RunShellScript \
        --instance-id <vmss-instance-id> \
        --output json \
        --scripts "dig mcr.microsoft.com 443"
    

解決方案

下表列出可能封鎖流量的特定原因,以及每個原因的對應解決方案。

問題 解決方案
流量遭到防火牆規則或 Proxy 伺服器封鎖 在此案例中,防火牆或 Proxy 伺服器會進行輸出篩選。 若要確認允許所有必要的網域和埠,請參閱控制 AKS) 中叢集節點的輸出流量 Azure Kubernetes Service (
流量會由叢集網路安全組封鎖 (NSG) 在連結至叢集的任何 NSG 上,確認埠 443、埠 53 或任何其他可能必須用來連線到端點的埠上沒有封鎖。 如需詳細資訊,請參閱控制 AKS) 中叢集節點的輸出流量 Azure Kubernetes Service (
AAAA (IPv6) 記錄在防火牆上遭到封鎖 在您的防火牆上,確認沒有任何專案會封鎖端點在 Azure DNS 中解析。
私人叢集無法解析內部 Azure 資源 在私人叢集中,如果使用自定義 DNS,則必須將 Azure DNS IP 位址 (168.63.129.16) 新增為上游 DNS 伺服器。 確認您的 DNS 伺服器上已設定位址。 如需詳細資訊,請 參閱建立私人 AKS 叢集什麼是 IP 位址 168.63.129.16?

其他相關資訊

協力廠商連絡資訊免責聲明

Microsoft 提供第三方連絡資訊,協助您尋找有關本主題的其他資訊。 此連絡資訊如有變更,恕不另行通知。 Microsoft 不保證第三方聯繫人信息的正確性。

與我們連絡,以取得說明

如果您有問題或需要相關協助,請建立支援要求,或詢問 Azure community 支援。 您也可以將產品意見反應提交給 Azure 意應見反社群