︿
Top

前言

昨天參加 Kubernetes in Azure 活動,通常在體驗 Azure 公有雲的活動中會拿到 Azure Pass 以便快速體驗 Azure 公有雲相關功能特色。但有些地方需要注意,否則在實作的過程中很容易遇到問題,以下就記錄一下昨天遇到然後當場解掉的問題吧 💪



申請 Microsoft 帳號

建議為 Azure Pass 申請新的 Microsoft 帳號,後續測試完畢或錢燒完或時間到 (一般來說 Azure Pass 會提供 USD $1001 個月試用期),也可以直接把這個 Microsoft 帳號刪除。

請連結至 https://signup.live.com/ 進行申請 Microsoft 帳號的動作:

圖、申請 Microsoft 帳號





透過 Azure Pass 啟用 Azure 訂閱帳戶

簡單來說,在你申請好 Microsoft 帳號之後,主辦單位會給你「Azure Pass Promo Code」此時,便可以連結至  Microsoft Azure Pass 網站進行啟用及開通 Azure 訂閱帳戶的動作。值得注意的是,應該了解及避免下列狀況:

  • 使用過 Azure Free Free Account 的 Microsoft 帳號無法使用 Azure Pass。
  • 曾經使用過 Azure Pass 的 Microsoft 帳號無法再次開通。
  • 避免使用 MSDN 訂閱帳戶來開通 Azure Pass。
  • Azure Pass 會有建立 5 台 VM 虛擬主機的限制。


有關透過 Azure Pass 啟用 Azure 訂閱帳戶的動作,官方已經有詳細說明就不重新造輪子了:
圖、透過 Azure Pass 啟用 Azure 訂閱帳戶





Azure CLI 指令 az acr login / create / repository 有問題?

在嘗試執行 Azure CLI 相關指令時 (例如,az acr login / create / repository) 都會有一堆錯誤訊息,其中關鍵錯誤訊息是「'bool' object has no attribute 'rstrip'」,根據錯誤訊息找到這篇討論 az acr login error: AttributeError: 'bool' object has no attribute 'rstrip' · Issue #5303 · Azure/azure-cli

簡單來說,剛好採用的是有問題的 Azure CLI 2.0.24 版本而導致的,只要下載最新的 Azure CLI 2.0.25 版本即可解決。

圖、最新 Azure CLI 2.0.25 版本可順利執行 az acr repository 指令





Azure Pass 訂閱帳戶無法使用所有的 Azure 資料中心?

在昨天的實作過程中,當透過 Azure CLI 指令嘗試建立 Kubernetes 叢集時,卻出現下列錯誤訊息,表示無法建立 Kubernetes Agent VM?
C:\> az acs create --orchestrator-type kubernetes --resource-group RG-US-West --name k8scluster --generate-ssh-keys --agent-count 1
Deployment failed. Correlation ID: e415a0f4-f9de-4882-8ed0-d60e46cf87a7. {
  "error": {
    "code": "BadRequest",
    "message": "The VM Size of Master, Agent is not allowed in your subscription in location 'westus'. Master VM Size 'Standard_D2_v2' is available in locations: eastus, westeurope, southeastasia. Agent VM Size 'Standard_D2_v2' is available in locations: eastus, westeurope, southeastasia."
  }
}


從上述訊息很容易得知,你指定的 Azure 資料中心並不支援建立 Kubernetes Agent VM,請你改為指定採用 eastus, westeurope, southeastasia 這 3 個資料中心即可。

圖、Azure Pass 訂閱帳戶此例僅適合建立指定的 3 個 Azure 資料中心





Azure Pass 訂閱帳戶無法建立 Kubernetes 叢集?

再調整為允許建立的 Azure 資料中心後,再次透過 Azure CLI 指令嘗試建立 Kubernetes 叢集時,又是出現一大堆的錯誤訊息 (但忘了抓畫面 😝),根據錯誤訊息找到這篇討論 az acs create fails on provisioning microsoft.network · Issue #1309 · Azure/azure-cli

簡單來說,因為使用的 Azure Pass 訂閱帳戶「沒有」透過 ARM Portal 建立過 VM 或其它資源,導致相關資源 (Network, Storage, Compute) 都還沒有註冊所以發生錯誤。你可以嘗試透過 ARM Portal 建立 1 台 VM 虛擬主機後再刪除,或者是執行下列 Azure CLI 指令註冊相關資源後,便應該可以順利建立 Kubernetes 叢集:
C:\>az provider register --namespace Microsoft.Network
Registering is still on-going. You can monitor using 'az provider show -n Microsoft.Network'

C:\>az provider register --namespace Microsoft.Compute
Registering is still on-going. You can monitor using 'az provider show -n Microsoft.Compute'

C:\>az provider register --namespace Microsoft.Storage
Registering is still on-going. You can monitor using 'az provider show -n Microsoft.Storage'


圖、註冊相關資源後,即可順利建立 Kubernetes 叢集

圖、註冊相關資源後,即可順利建立 Kubernetes 叢集





關閉測試用途 Microsoft 帳戶

當測試完畢或 Azure Pass 額度用完 (錢燒完) 或試用時間到期 (一般來說 Azure Pass 會提供 USD $100 及 1 個月試用期),便可以直接把這個測試用途的 Microsoft 帳號刪除

圖、關閉測試用途 Microsoft 帳戶





其它參考資源

文章標籤: ,