如要以 GKE 連結叢集的形式運作,叢集必須具備下列特徵。
EKS (AWS) 叢集需求
請確認你使用的是支援的平台版本。叢集 Kubernetes 的主要版本和次要版本應與所選平台版本相符。您也可以使用下列指令列出所有支援的版本:
gcloud container attached get-server-config \ --location=GOOGLE_CLOUD_REGION
將
GOOGLE_CLOUD_REGION
替換為要從中管理叢集的Google Cloud 位置名稱。確認本機已安裝
kubectl
指令列工具,並已設定存取叢集。包括在kubeconfig
檔案中設定正確的使用者憑證。確認叢集已連上網路。
叢集必須有公開的 IAM OIDC 身分識別提供者。 如要檢查供應商是否存在,並視需要建立供應商,請按照「為叢集建立 IAM OIDC 供應商」一文中的操作說明進行。
附加叢集時, Google Cloud 會安裝由 Google Cloud管理的數個 Pod。這些 Pod 必須排定在節點上執行。請確認叢集上的任何污點不會阻礙排程。如果存在這類汙點,叢集註冊就會失敗,您可能會看到類似下列的錯誤:
1 node(s) had untolerated taint {CriticalAddOnsOnly: true}
網路需求
由於連結的叢集依賴支援服務,因此您需要修改叢集的傳出防火牆規則,允許叢集存取下列網域。 Google Cloud 如要安裝及執行 GKE 連接的叢集,您只需對叢集進行這項變更。
地址 | 目的 |
---|---|
.gcr.io |
從 Artifact Registry 提取映像檔。 |
gkeconnect.googleapis.com |
建立用於接收要求和發出回應的管道。 Google Cloud |
gkemulticloud.googleapis.com |
將 Google 或第三方憑證換成短期存取權杖,以存取 Google Cloud 資源。如果叢集是使用 Google Cloud 區域註冊至機群,您需要將REGION-gkemulticloud.googleapis.com (例如 us-central1-gkemulticloud.googleapis.com ) 加入允許清單。 |
oauth2.googleapis.com |
透過 OAuth 權杖交換進行驗證,以存取帳戶。 |
securetoken.googleapis.com |
擷取 Workload Identity 授權的重新整理權杖。 |
storage.googleapis.com |
管理物件儲存空間和值區,例如 Artifact Registry 物件。 |
sts.googleapis.com |
以 Google 或第三方憑證換取短期存取權杖,存取 Google Cloud 資源。 |
www.googleapis.com |
驗證傳入服務要求中的服務權杖。 Google Cloud |
記錄和監控
如要使用記錄和監控功能,叢集也必須能夠存取下列網址:
logging.googleapis.com
monitoring.googleapis.com
opsconfigmonitoring.googleapis.com
kubernetesmetadata.googleapis.com
Google Cloud 需求條件
將叢集附加至 Google Cloud 管理服務之前,請先安裝 gcloud CLI (包括 Google Cloud CLI 指令),並將 Google Cloud 帳戶的存取權授予 Google Cloud 管理服務,以便管理附加叢集的資源。
使用下列指令檢查 gcloud CLI 安裝狀態:
gcloud version
如果尚未安裝 gcloud CLI,或是版本低於 412.0.0,請按照 gcloud CLI 安裝說明安裝 412.0.0 以上版本。
安裝
kubectl
其他元件。如果您還沒有專案,請先建立 Google Cloud 專案。系統會產生 Google Cloud 專案 ID 和專案編號。
使用下列指令設定有效專案並驗證帳戶。 Google Cloud
export PROJECT_ID=<your project id> gcloud auth login gcloud config set project $PROJECT_ID gcloud auth application-default login
使用下列指令啟用 GKE Attached Clusters API 及其必要服務:
gcloud services enable gkemulticloud.googleapis.com gcloud services enable gkeconnect.googleapis.com gcloud services enable connectgateway.googleapis.com gcloud services enable cloudresourcemanager.googleapis.com gcloud services enable anthos.googleapis.com gcloud services enable logging.googleapis.com gcloud services enable monitoring.googleapis.com gcloud services enable opsconfigmonitoring.googleapis.com gcloud services enable kubernetesmetadata.googleapis.com