共用方式為


針對 K8sVersionValidation 錯誤碼進行疑難解答

本文說明如何識別並解決當您嘗試在 Azure 本機上建立及部署 AKS 叢集時所發生的 K8sVersionValidation 錯誤碼。

徵兆

當您嘗試建立 AKS Arc 叢集時,您會收到下列其中一個錯誤訊息:

  • Kubernetes version 1.27.7 is not ready for use on Linux. Please go to https://aka.ms/aksarccheckk8sversions for details of how to check the readiness of Kubernetes versions
  • Kubernetes version 1.26.12 is not supported. Please go to https://aka.ms/aksarcsupportedversions for details about the supported Kubernetes version on this platform.
  • Admission webhook \'vhybridakscluster.kb.io\' denied the request: Kubernetes version 1.26.12 is not available

錯誤訊息

本節描述您在遇到 K8sVersionValidation 錯誤碼時可能會看到的錯誤訊息。

Kubernetes 1.27.7 版尚未準備好在Linux上使用

此錯誤訊息是由不完整的 Linux VHD 下載所造成。

當您安裝 Azure 本機時,您會下載大小約為 4-5 GB 的 Linux VHD。 此 Linux VHD 可用來為 AKS Arc 叢集中的 Kubernetes 節點建立基礎 VM。 當 Linux VHD 未完成下載時,可能會發生錯誤訊息。 若要解決此問題,您應該等到因特網連線完成下載Linux VHD映像為止。

若要檢查映像下載是否正在進行中或完成,請執行下列命令:

$cl_id = "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.ExtendedLocation/customLocations/<custom_location_name>"
          
# Get the kubernetes version using CLI (it automatically creates the **kubernetesVersions/default** Azure resource).
az aksarc get-versions --custom-location $cl_id

如果此命令指出 K8s 版本已就緒,而且您正在執行 Azure Local 2411 版或更新版本,請提出 支援要求

如果您執行 Azure 本機版本 2408 或更新版本,請繼續進行下一節。 強烈建議您將 Azure 本機部署升級至最新版本,以取得最新的錯誤修正和安全性更新。

重新建立 kubernetesVersions/default

如果您使用相同的名稱和參數重新部署 Azure Local,您可能需要重新建立 kubernetesVersions/default。 若要這樣做,請執行下列 命令:

$subscription = <subscription_id>
$cl_id = <custom_location_id>

az login --use-device-code
az account set -s $subscription
$token = $(az account get-access-token --query accessToken)
$url = "https://management.azure.com${cl_id}/providers/Microsoft.HybridContainerService/kubernetesVersions/default?api-version=2024-01-01"

# Get the Kubernetes version Azure resource
az rest --headers "Authorization=Bearer $token" "Content-Type=application/json;charset=utf-8" --uri $url --method GET

# Delete the Kubernetes version Azure resource
az rest --headers "Authorization=Bearer $token" "Content-Type=application/json;charset=utf-8" --uri $url --method DELETE

# Get the Kubernetes version using CLI (it automatically creates the Kubernetes version Azure resource)
az aksarc get-versions --custom-location $cl_id

在 Azure 入口網站 上看不到 Kubernetes 版本或 VM 大小選項

當 Kubernetes 版本(或 VM 大小)未在 Azure 本機部署中建立預設資源時,Azure 本機版本 2408 或更舊版本可能會發生此案例。

若要解決此問題,請執行下列命令:

$cl_id = "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.ExtendedLocation/customLocations/<custom_location_name>"
          
# Get the kubernetes version using CLI (it automatically creates the **kubernetesVersions/default** Azure resource).

az aksarc get-versions --custom-location $cl_id

不支援 Kubernetes 1.26.12 版

Azure Local 支援其每個版本中的特定 Kubernetes 版本。 如錯誤訊息中所述,請移至 https://aka.ms/aksarcsupportedversions 以您部署的 Azure 本機版本為基礎的支援 Kubernetes 版本清單。

下一步

針對 Azure Arc 啟用的 AKS 中的問題進行疑難解答