本文提供 Azure Kubernetes Fleet Manager DNS 型負載平衡的疑難解答資訊。 Fleet Manager DNS 負載平衡會使用 Azure 流量管理員來平衡來自多個 Azure Kubernetes Service (AKS) 成員叢集之公用端點之間的流量。
使用 Fleet Manager 中樞叢集進行疑難解答
用戶應該能夠存取建立 Azure 流量管理員配置檔的 Azure 訂用帳戶和資源群組。
安裝或升級至 Azure CLI 2.72.0 版或更新版本。
請確定已安裝 Kubernetes kubectl 命令行工具。 您可以執行 az aks install-cli 命令來安裝 kubectl。
使用 命令安裝
az extension addAzure CLI 擴充功能。 請確定已安裝的版本至少為 1.5.2。az extension add --name fleet存取 Fleet Manager 中樞叢集 Kubernetes API。 如需詳細資訊,請參閱 存取 Fleet Manager 中樞叢集 API。
案例 1:無法建立 TrafficManagerProfile 或 流量管理員
本節提供 Kubernetes 物件及其相關聯的 Azure 流量管理員資源未建立的情境下的常見原因和解決方案 TrafficManagerProfile 。
若要判斷適當的解析度,請使用顯示的命令檢查 Fleet Manager 中樞叢集上物件的狀態 TrafficManagerProfile 。
kubectl get trafficmanagerprofile -n <namespace> <profile-name> -o yaml
錯誤 1:客戶端沒有執行動作的授權
如果符合下列其中一個條件,就可能發生此問題:
- 指令清單中指定了不存在的
TrafficManagerProfileAzure 資源群組。 - 資源群組與 Fleet Manager 資源不在相同的 Azure 訂用帳戶中。
- Fleet Manager 中樞叢集身分識別無權在指定的資源群組中建立和管理 Azure 流量管理員配置檔。
您可以檢查 TrafficManagerProfile 狀態以取得錯誤的詳細資料。 下列 TrafficManagerProfile 狀態的範例顯示權限不足:
status:
conditions:
- lastTransitionTime: "2025-04-29T02:57:33Z"
message: |
Invalid profile: GET https://management.azure.com/subscriptions/xxx/resourceGroups/your-fleet-atm-rg/providers/Microsoft.Network/trafficmanagerprofiles/fleet-yyyy
--------------------------------------------------------------------------------
RESPONSE 403: 403 Forbidden
ERROR CODE: AuthorizationFailed
--------------------------------------------------------------------------------
{
"error": {
"code": "AuthorizationFailed",
"message": "The client 'xxx' with object id 'xxx' does not have authorization to perform action
'Microsoft.Network/trafficmanagerprofiles/read' over scope
'/subscriptions/xxx/resourceGroups/your-fleet-atm-rg/providers/Microsoft.Network/trafficmanagerprofiles/fleet-yyyy' or the
scope is invalid. If access was recently granted, please refresh your credentials."
}
}
--------------------------------------------------------------------------------
observedGeneration: 1
reason: Invalid
status: "False"
type: Programmed
解決方法
要解決這個問題,請按照以下步驟進行:
- 請確定 Azure 資源群組存在,且具有 Fleet Manager 擁有的相同 Azure 訂用帳戶值。
- 請確認已將角色授與 Fleet Manager 中樞叢集身分識別,且範圍設為資源群組。 如需詳細資訊,請參閱 設定 Fleet Manager 許可權。
錯誤 2:網域名稱無法使用
如果另一個 Azure 流量管理員配置檔已經使用產生的 DNS 前置詞,就可能發生此問題。 DNS 前置詞是由指令清單中的metadata.name命名空間和TrafficManagerProfile欄位所組成。 例如,如果命名空間為 ,且 team-a 為 metadata.namewebapp,則 DNS 前置詞為 team-a-webapp。
下列狀態範例 TrafficManagerProfile 顯示網域名稱無法使用:
status:
conditions:
- lastTransitionTime: "2025-04-29T06:39:10Z"
message: Domain name is not available. Please choose a different profile name or namespace
observedGeneration: 2
reason: DNSNameNotAvailable
status: "False"
type: Programmed
解決方法
若要解決此問題,請使用 nslookup 或類似工具來判斷完整 DNS 名稱 (例如, team-a-webapp.trafficmanager.net) 是否已結束。 如果名稱不可用,請考慮下列其中一個替代方案:
- 將
metadata.name指令清單中的TrafficManagerProfile欄位變更為唯一的名稱。 - 針對
TrafficManagerProfile指令清單使用不同的命名空間。 此選取範圍會影響TrafficManagerBackend和ServiceExport物件。 這些對象必須位於相同的命名空間中。
錯誤 3:已達到 Azure 流量管理員訂用帳戶限制
如果單一 Azure 訂用帳戶內有 200 個以上的流量管理員配置檔或端點,就可能發生此問題。
下列狀態範例 TrafficManagerProfile 顯示已達到 Azure 流量管理員設定檔限制:
status:
conditions:
- lastTransitionTime: "2025-04-29T06:39:10Z"
message: Azure Traffic Manager profile limits reached.
observedGeneration: 2
reason: Invalid
status: "False"
type: Programmed
解決方法
請考慮刪除未使用的配置檔,或要求增加限制。 如需詳細資訊,請參閱 Azure 流量管理員限制。
錯誤 4:Azure 流量管理員傳回錯誤
如果 Azure 流量管理員服務在建立配置檔時傳回錯誤,就可能發生此問題。
TrafficManagerProfile 狀態的以下範例顯示了此錯誤:
status:
conditions:
- lastTransitionTime: "2025-04-29T06:39:10Z"
message: Azure Traffic Manager error message is displayed here.
observedGeneration: 2
reason: Invalid
status: "False"
type: Programmed
解決方法
如果錯誤持續發生,請檢查 Azure 流量管理員服務健康情況。
案例 2:無法建立 TrafficManagerBackend
本節提供無法建立 Kubernetes 物件之案例 TrafficManagerBackend 的常見原因和建議解決方案。
若要判斷適當的解析度,請使用顯示的命令檢查 Fleet Manager 中樞叢集上物件的狀態 TrafficManagerBackend 。
kubectl get trafficmanagerbackend -n <namespace> <backend-name> -o yaml
錯誤 1:找不到 TrafficManagerProfile 或 TrafficManagerProfile 無效
如果符合下列其中一個條件,就可能發生此問題:
-
TrafficManagerBackend是在與TrafficManagerProfile不同的命名空間中建立的。 -
TrafficManagerProfile物件存在,但找不到相關聯的 Azure 流量管理員資源。
以下是顯示錯誤的狀態範例 TrafficManagerBackend 。
status:
conditions:
- lastTransitionTime: "2025-04-29T06:43:57Z"
message: TrafficManagerProfile "nginx-nginx-profile" is not found
observedGeneration: 1
reason: Invalid
status: "False"
type: Accepted
缺少 Azure 流量管理員資源。
status:
conditions:
- lastTransitionTime: "2025-04-29T07:00:04Z"
message: 'Invalid trafficManagerProfile "nginx-nginx-profile": Domain name is not available.
Please choose a different profile name or namespace'
observedGeneration: 1
reason: Invalid
status: "False"
type: Accepted
解決方法
要解決這個問題,請按照以下步驟進行:
- 請確定您在與
TrafficManagerBackend相同的命名空間中建立TrafficManagerProfile。 - 請確定
Programmed的條件TrafficManagerProfile為Accepted。 如果不是,請檢查配置檔定義是否有效,然後重新提交。 - 請確定 Azure 流量管理員資源存在。 若要重新建立資源,請從 Fleet Manager 中樞叢集刪除
TrafficManagerProfile。 然後重新套用它。
錯誤 2:服務或服務匯出 無效
如果符合下列其中一個條件,就可能發生此問題:
-
Service是在與TrafficManagerBackend物件不同的命名空間中建立的。 -
Service存在,但ServiceExport對象並未在與TrafficManagerBackend相同的命名空間中建立。 -
Service未定義為LoadBalancer型別。 -
Service不會透過 Azure 公用 IP 位址公開,也不會指派 DNS 名稱。
以下TrafficManagerBackend狀態的範例顯示了錯誤:
status:
conditions:
- lastTransitionTime: "2025-04-29T07:50:49Z"
message: ServiceImport "invalid-service" is not found
observedGeneration: 1
reason: Invalid
status: "False"
type: Accepted
Service未定義為LoadBalancer類型:
status:
conditions:
- lastTransitionTime: "2025-04-29T07:56:05Z"
message: '1 service(s) exported from clusters cannot be exposed as the Azure
Traffic Manager, for example, service exported from aks-member-5 is invalid:
unsupported service type "ClusterIP"'
observedGeneration: 1
reason: Invalid
status: "False"
type: Accepted
解決方法
要解決這個問題,請按照以下步驟進行:
- 確保至少有一
Service個成員叢集在TrafficManagerBackend物件的相同命名空間中通過建立ServiceExport進行匯出。 - 請確定匯出
Service的 是負載平衡器類型,並透過 Azure 公用 IP 位址公開。 此位址必須有指派的 DNS 名稱,才能用於流量管理員配置檔中。
錯誤 3:找不到 Azure 流量管理員配置檔
如果符合下列其中一個條件,就可能發生此問題:
-
TrafficManagerProfile物件存在,但找不到相關聯的 Azure 流量管理員資源。 - Fleet Manager 中樞叢集身分識別無權在指定的資源群組中建立和管理 Azure 流量管理員配置檔或端點。
下列 TrafficManagerBackend 狀態的範例顯示錯誤:
status:
conditions:
- lastTransitionTime: "2025-05-08T09:38:36Z"
message: Azure Traffic Manager profile "fleet-6dd24764-0e46-4b52-b9c6-cc2a3f2535f9" under "your-fleet-atm-rg" is not found
observedGeneration: 2
reason: Invalid
status: "False"
type: Accepted
解決方法
要解決這個問題,請按照以下步驟進行:
- 請確定 Azure 流量管理員資源存在。 若要重新建立資源,請從 Fleet Manager 中樞叢集刪除
TrafficManagerProfile配置檔,然後重新套用它。 - 確認已為 Fleet Manager 中樞叢集身分識別授與限定於資源群組的
Traffic Manager Contributor角色。 如需詳細資訊,請參閱 設定 Fleet Manager 許可權。
錯誤 4:已達到 Azure 流量管理員設定檔限制
如果在單一 Azure 訂用帳戶內建立超過 200 個 Azure 流量管理員端點,可能會發生此問題。
下列 TrafficManagerBackend 狀態的範例顯示錯誤:
status:
conditions:
- lastTransitionTime: "2025-04-29T06:39:10Z"
message: Azure Traffic Manager profile limits reached.
observedGeneration: 2
reason: Invalid
status: "False"
type: Programmed
解決方法
請考慮刪除未使用的端點。 如需詳細資訊,請參閱 Azure 流量管理員限制。
使用 Azure Log Analytics 進行疑難解答
除了查詢 Fleet Manager 中樞叢集之外,您還可以使用 Azure Log Analytics 進行疑難解答。
TrafficManagerProfile
篩選fleet-hub-net-controller-manager類別中的項目,方法是使用trafficmanagerprofile/controller.go:
AzureDiagnostics
| where Category == "fleet-hub-net-controller-manager"
| project TimeGenerated, ResourceId, log_s
| where ResourceId == "/subscriptions/xxx/resourceGroups/your-fleet-rg/providers/Microsoft.ContainerService/fleets/your-fleet"
| where log_s contains "trafficmanagerprofile/controller.go"
| limit 1000
流量管理後端
篩選fleet-hub-net-controller-manager類別中的項目,方法是使用trafficmanagerbackend/controller.go:
AzureDiagnostics
| where Category == "fleet-hub-net-controller-manager"
| project TimeGenerated, ResourceId, log_s
| where ResourceId == "/subscriptions/xxx/resourceGroups/your-fleet-rg/providers/Microsoft.ContainerService/fleets/your-fleet"
| where log_s contains "trafficmanagerbackend/controller.go"
| limit 1000
第三方聯繫人免責聲明
Microsoft 提供協力廠商連絡資訊,以協助您尋找有關此主題的其他資訊。 此連絡資訊可能會變更而不另行通知。 Microsoft 不保證協力廠商連絡資訊的準確性。
與我們連絡,以取得說明
如果您有疑問,可以詢問 Azure 社群支援。 您也可以向 Azure 意見反應社群提交產品意見反應。