常見問題集: Amazon EKS 附加元件
我對 Amazon Elastic Kubernetes Service (Amazon EKS) 附加元件有一些疑問。
**注意:**如果您在執行 AWS Command Line Interface (AWS CLI) 命令時收到錯誤訊息,請參閱 Troubleshoot AWS CLI errors (對 AWS CLI 錯誤進行疑難排解)。此外,請務必使用最新版 AWS CLI。
**問:**如何查看我 Amazon EKS 叢集中的 Amazon EKS 附加元件部署失敗的原因?
若要查看失敗原因,請使用 Amazon EKS 主控台或 AWS CLI。
在 Amazon EKS 主控台上,請完成以下步驟:
- 開啟 Amazon EKS 主控台。
- 在導覽窗格中,選擇 Clusters (叢集)。然後選取您想要建立附加元件之叢集的名稱。
- 選擇 Add-ons (附加元件) 索引標籤。
- 選取處於 Degraded (降級)、Pending (待處理) 或 Inactive (非作用中) 狀態的附加元件。您可以在 Health issues (運作狀態問題) 區段找到失敗的原因。
-或-
執行 AWS CLI 的 describe-addon 命令:
$ aws eks describe-addon --cluster-name example-cluster --addon-name coredns
您可以在 Addonissue 物件中找到失敗的原因。
輸出範例:
{ "addon": { "addonName": "coredns", "clusterName": "eksn", "status": "DEGRADED", "addonVersion": "v1.8.7-eksbuild.4", "health": { "issues": [ { "code": "InsufficientNumberOfReplicas", "message": "The add-on is unhealthy because it doesn't have the desired number of replicas." } ] } "addonArn": "arn:aws:eks:us-east-2:acc-ID:addon/EKS_CLUSTER/coredns/76c68b04-0804-2419-8da6-90d8318af308", "createdAt": "2024-01-17T06:07:23.826000+00:00", "modifiedAt": "2024-04-19T04:40:03.537000+00:00", "tags": {} } }
**問:**我收到下列錯誤訊息: "The add-on is unhealthy because it doesn't have the desired number of replicas"。 我該如何對此錯誤進行疑難排解?
若要檢查叢集中對應 Pod 的狀態,請執行下列命令:
kubectl get pods -n kube-system kubectl describe pod pod-name -n kube-system kubectl logs pod-name -n kube-system
將 pod-name 替換為您的 Pod 名稱。
若要解析輸出中的 Pod 狀態,請參閱如何對 Amazon EKS 中的 Pod 狀態進行疑難排解?
**問:**我收到下列錯誤訊息: "Conflicts found when trying to apply.Will not continue to due to resolve conflicts mode"。 我該如何對此錯誤進行疑難排解?
請將組態寫入 JSON 檔案中,然後將檔案套用到附加元件。如需更多資訊,請參閱如何在建立或更新 Amazon EKS 受管附加元件時防止組態衝突?
**問:**該如何自訂 Amazon EKS 附加元件組態?
若要為附加元件建立自訂組態,請在 CreateAddon API 中使用 ConfigurationValue 參數。
若要查看 CoreDNS 附加元件的組態選項,請執行 describe-addon 命令:
aws eks describe-addon-configuration --addon-name coredns --addon-version v1.9.3-eksbuild.2 --query configurationSchema --output text | jq
輸出範例:
{ "$ref": "#/definitions/Coredns", "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { "Coredns": { "additionalProperties": false, "properties": { "computeType": { "type": "string" }, "corefile": { "description": "Entire corefile contents to use with installation", "type": "string" }, "nodeSelector": { "additionalProperties": { "type": "string" }, "type": "object" }, "replicaCount": { "type": "integer" }, "resources": { "$ref": "#/definitions/Resources" } }, "title": "Coredns", "type": "object" }, "Limits": { "additionalProperties": false, "properties": { "cpu": { "type": "string" }, "memory": { "type": "string" } }, "title": "Limits", "type": "object" }, "Resources": { "additionalProperties": false, "properties": { "limits": { "$ref": "#/definitions/Limits" }, "requests": { "$ref": "#/definitions/Limits" } }, "title": "Resources", "type": "object" } } }
輸出中的 configurationSchema 元素,為所選版本的 CoreDNS 附加元件提供了可設定元素。
若要更新此附加元件,請依據 JSON 結構描述指定自訂組態。例如,若要協助將 CoreDNS 部署的 Pod 排程到特定節點叢集上,您可以自訂 nodeSelector 參數中的 selector_value。
範例:
{ "nodeSelector": { "selector_key": "selector_value" } }
問: 當我嘗試使用自訂組態建立或更新附加元件時,為什麼會收到下列錯誤: "ConfigurationValue provided in request is not supported: Json schema validation failed with error"?
下列組態會導致此錯誤:
... "Limits": { "cpu":"100m", "memory":"500Mi" } ...
請確認您的進階組態符合附加元件版本支援的 configurationSchema 格式。若要為 CoreDNS 附加元件指定資源配額與請求,請執行下列結構描述:
... { "resources": { "limits": { "cpu": "200m", "memory": "200Mi", }, "requests": { "cpu": "100m", "memory": "100Mi" } } } ...
**問:**為什麼我在更新附加元件後,Amazon EKS 將帶有自訂參數的 JSON 結構描述還原為預設參數?
當您在執行 UpdateAddon API 操作時,沒有在 configurationValues 欄位中包含這個附加元件的自訂參數,該附加元件就會恢復為預設參數。
若要在更新附加元件時保留您對組態的修改,請採取下列其中一種行動:
在每次執行 UpdateAddon API 操作時,於 configurationValues 參數中包含自訂參數。
-或-
在 UpdateAddon 操作中使用 --resolve-conflicts PRESERVE 選項。
**問:**如何確認附加元件是由 Amazon EKS 管理還是自行管理?
若要檢查部署在叢集中的附加元件類型,請執行 AWS CLI 的 describe-addon 命令:
aws eks describe-addon --cluster-name example-cluster --addon-name example-addon --query addon.addonVersion --output text
**注意:**請將 example-cluster 替換為您的叢集名稱,並將 example-addon 替換為您的附加元件名稱。
如果輸出提供您附加元件的相關資訊,表示該附加元件由 Amazon EKS 管理。如果輸出顯示錯誤訊息,則該附加元件為自行管理。
**問:**如何將叢集中的自行管理附加元件遷移到 Amazon EKS 附加元件?
請使用適當的衝突解決方式來建立 Amazon EKS 附加元件。
建立 Amazon EKS 附加元件時,您可以在 configurationSchema 欄位中傳遞自訂組態。
若為維持叢集內的組態變更,更新或刪除附加元件時請使用 PRESERVE 選項。若要維持 Kubernetes API 對 Amazon EKS 附加元件未管理欄位所做的變更,請使用 PRESERVE 選項。若結構描述不支援此受管欄位,您可以手動在附加元件部署或 DaemonSet 中加入自訂設定。接著,在下一次更新操作時使用 PRESERVE 選項。
若選擇 OVERWRITE 作為衝突解決方法,Amazon EKS 將還原附加元件的自訂設定,並以預設值覆寫您的值。
**問:**如何將 Amazon EKS 附加元件遷移到自行管理附加元件?
您必須先從 Amazon EKS 叢集中移除該 Amazon EKS 附加元件,再執行 delete-addon 命令:
aws eks delete-addon --cluster-name example-cluster --addon-name example-addon --preserve
**注意:**請將 example-cluster 替換為您的叢集名稱,並將 example-addon 替換為您的附加元件名稱。使用 --preserve 旗標以保留底層 Kubernetes 資源。
- 語言
- 中文 (繁體)

相關內容
已提問 2 年前
已提問 3 年前
已提問 3 年前
AWS 官方已更新 1 年前