建立及管理節點集區

本頁說明如何在 Distributed Cloud connected 區域中,建立及管理 Google Distributed Cloud 節點集區資源。

在 Distributed Cloud 連線伺服器上,建立叢集時,系統會自動建立及填入節點集區。建立叢集後,您也可以選擇設定其他節點集區。

如要進一步瞭解 Distributed Cloud 節點集區,請參閱「Distributed Cloud connected 的運作方式」。

建立節點集區

如要建立 Distributed Cloud 節點集區,請完成本節中的步驟。

如要完成這項工作,您必須在Google Cloud 專案中具備下列角色:

  • Edge Container 管理員角色 (roles/edgecontainer.admin)
  • Edge Container 機器使用者角色 (roles/edgecontainer.machineUser)

    如果專案與Google Cloud 建立節點集區的專案不同,您也必須在包含要指派給這個節點集區的 Distributed Cloud 連線機器的 Google Cloud 專案中,具備這個角色。

控制台

如果使用 Google Cloud 控制台,只能在建立叢集時建立節點集區。如要建立獨立節點集區,請使用 Google Cloud CLI 或 Distributed Cloud Edge Container API。

gcloud

使用 gcloud edge-cloud container clusters node-pools create 指令:

gcloud edge-cloud container clusters node-pools create POOL_NAME \
    --project=PROJECT_ID \
    --location=REGION \
    --cluster=CLUSTER_NAME \
    --node-location=ZONE_NAME \
    --node-count=NODE_COUNT \
    --node-labels=NODE_LABELS \
    --machine-filter=MACHINE_FILTER \
    --local-disk-kms-key=POOL_KMS_KEY \
    --node-storage-schema=WORKER_NODE_STORAGE_SCHEMA

更改下列內容:

  • POOL_NAME:可清楚識別這個節點集區的說明名稱。這個名稱必須符合 RFC 1213 規範,且只能包含小寫英數字元和連字號 (-),開頭和結尾須為英數字元。
  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:這個節點集區的目標 Distributed Cloud 連結網路叢集所在的 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。
  • ZONE_NAME:目標 Distributed Cloud 可用區的名稱。這個區域必須位於 REGION 中指定的區域。
  • NODE_COUNT:這個節點集區擁有的節點數量。
  • NODE_LABELS:以半形逗號分隔的鍵/值組合清單,包含節點集區中個別節點的標籤。
  • MACHINE_FILTER (選用):指定機器選取的篩選條件。如要查看可篩選的欄位,請參閱「取得機器相關資訊」。只有符合這個篩選條件的機器才能加入這個節點集區。 如果是多機架叢集,請使用這個標記指定 Distributed Cloud 連線機架,這些機架的節點會組成這個節點集區。如果省略,系統會將可用區中的所有可用節點新增至這個節點集區。
  • POOL_KMS_KEY (選用):要用於這個節點集區的 Cloud KMS 金鑰完整路徑。例如:

    /projects/myProject/locations/us-west1-a/keyRings/myKeyRing/cryptoKeys/myGDCE-Key
    

    只有在您已整合 Distributed Cloud 並連線至 Cloud Key Management Service 時,這個標記才適用,詳情請參閱「為本機儲存空間啟用客戶自行管理的加密金鑰 (CMEK) 支援」。

  • WORKER_NODE_STORAGE_SCHEMA (選用):指定這個節點集區所含工作站節點的本機儲存空間結構。詳情請參閱「設定本機儲存空間結構定義」。

API

projects.locations.clusters.nodePools.create 方法發出 POST 要求:

POST /v1/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME?nodePoolId=NODEPOOL_ID&requestId=REQUEST_ID
{
 "name": POOL_NAME,
 "labels": { LABELS,
  },
 "nodeLocation": ZONE_NAME,
 "nodeCount": NODE_COUNT,
 "nodeLabels": NODE_LABELS,
 "machineFilter": MACHINE_FILTER,
 "localDiskEncryption": {
   "kmsKey": POOL_KMS_KEY,
  }
}

更改下列內容:

  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:這個節點集區的目標 Distributed Cloud 連結網路叢集所在的 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。
  • NODEPOOL_ID:可識別這個節點集區資源的專屬程式輔助 ID。
  • REQUEST_ID:用於識別這項要求的專屬程式輔助 ID。
  • POOL_NAME:可清楚識別這個節點集區的專屬名稱。
  • LABELS:要套用至這個節點集區資源的標籤清單。
  • ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。這個區域必須位於 REGION 中指定的區域。
  • NODE_COUNT:這個節點集區擁有的節點數量。
  • NODE_LABELS:以半形逗號分隔的鍵/值組合清單,包含節點集區中個別節點的標籤。
  • MACHINE_FILTER (選用):指定機器選取的篩選條件。只有符合這個篩選條件的機器才能加入這個節點集區。如果是多機架叢集,請使用這個標記指定 Distributed Cloud connected 機架,這些機架的節點會組成這個節點集區。如果省略,系統會將可用區中的所有可用節點新增至這個節點集區。
  • POOL_KMS_KEY (選用):要用於這個節點集區的 Cloud KMS 金鑰完整路徑。例如:

    /projects/myProject/locations/us-west1-a/keyRings/myKeyRing/cryptoKeys/myGDCE-Key
    

    只有在您已整合 Distributed Cloud connected 與 Cloud Key Management Service 時,這個參數才適用,如「為本機儲存空間啟用客戶自行管理的加密金鑰 (CMEK) 支援」一文所述。

列出節點集區

如要列出 Distributed Cloud 連線區域中可用的 Distributed Cloud 節點集區,請完成本節中的步驟。

如要完成這項工作,您必須在 Google Cloud 專案中擁有Edge Container 檢視者角色roles/edgecontainer.viewer

gcloud

使用 gcloud edge-cloud container clusters node-pools list 指令:

gcloud edge-cloud container clusters node-pools list \
    --project=PROJECT_ID \
    --location=REGION \
    --cluster=CLUSTER_NAME

更改下列內容:

  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:建立目標 Distributed Cloud 連結網路叢集的 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。

API

projects.locations.clusters.nodePools.list 方法發出 GET 要求:

GET /v1/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME/nodePools?filter=FILTER&pageSize=PAGE_SIZE&orderBy=SORT_BY&pageToken=PAGE_TOKEN

更改下列內容:

  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:建立目標 Distributed Cloud connected 叢集的 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 叢集的名稱。
  • FILTER:限制傳回結果為特定值的運算式。
  • PAGE_SIZE:每頁要傳回的結果數。
  • SORT_BY:以半形逗號分隔的欄位名稱清單,做為傳回結果的排序依據。預設排序順序為遞增;如要遞減排序,請在所需欄位前面加上 ~
  • PAGE_TOKEN:在回應的 nextPageToken 欄位中,對最後一個清單要求的回應中收到的權杖。傳送這個符記即可接收結果頁面。

取得節點集區的相關資訊

如要取得 Distributed Cloud 節點集區的相關資訊,請完成本節中的步驟。

如要完成這項工作,您必須在 Google Cloud 專案中擁有Edge Container 檢視者角色roles/edgecontainer.viewer

gcloud

使用 gcloud edge-cloud container clusters node-pools describe 指令:

gcloud edge-cloud container clusters node-pools describe POOL_NAME \
    --project=PROJECT_ID \
    --location=REGION \
    --cluster=CLUSTER_NAME

更改下列內容:

  • POOL_NAME:目標節點集區的名稱。
  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:與這個節點集區相關聯的 Distributed Cloud connected 叢集代管所在 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。

API

projects.locations.clusters.nodePools.get 方法發出 GET 要求:

GET /v1/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME/nodePools/POOL_NAME

更改下列內容:

  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:與這個節點集區相關聯的 Distributed Cloud connected 叢集代管所在 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。
  • POOL_NAME:目標節點集區的名稱。

修改節點集區

如要修改 Distributed Cloud 節點集區,請完成本節中的步驟。

如要完成這項工作,您必須在 Google Cloud 專案中擁有Edge Container 管理員角色roles/edgecontainer.admin

gcloud

使用 gcloud edge-cloud container clusters node-pools update 指令:

gcloud edge-cloud container clusters node-pools update POOL_NAME \
    --project=PROJECT_ID \
    --location=REGION \
    --cluster=CLUSTER_NAME \
    --node-count=NODE_COUNT \
    --machine-filter=MACHINE_FILTER \
    --local-disk-kms-key=POOL_KMS_KEY

更改下列內容:

  • POOL_NAME:目標節點集區的名稱。
  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:與這個節點集區相關聯的 Distributed Cloud connected 叢集代管所在 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud connected 叢集的名稱。
  • NODE_COUNT:這個節點集區擁有的節點數量。
  • MACHINE_FILTER (選用):指定機器選取的篩選條件。如要查看可篩選的欄位,請參閱「取得機器相關資訊」。如果是多機架叢集,請使用這個標記指定 Distributed Cloud 連線機架,這些機架的節點會組成這個節點集區。
  • POOL_KMS_KEY (選用):要用於這個節點集區的 Cloud KMS 金鑰完整路徑。例如:

    /projects/myProject/locations/us-west1-a/keyRings/myKeyRing/cryptoKeys/myGDCE-Key
    

    只有在您已整合 Distributed Cloud 並連線至 Cloud Key Management Service 時,這個標記才適用,詳情請參閱「為本機儲存空間啟用客戶自行管理的加密金鑰 (CMEK) 支援」。

    如要將節點集區還原為使用 Google 管理的金鑰,請使用 --use-google-managed-key 旗標。

API

projects.locations.clusters.nodePools.patch 方法發出 PATCH 要求:

PATCH /v1/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME?nodePoolId=NODEPOOL_ID&requestId=REQUEST_ID
{
 "name": POOL_NAME,
 "labels": { LABELS,
  },
 "nodeLocation": ZONE_NAME,
 "nodeCount": NODE_COUNT,
 "machineFilter": MACHINE_FILTER,
 "localDiskEncryption": {
   "kmsKey": KMS_KEY,
  }
}

更改下列內容:

  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:與這個節點集區相關聯的 Distributed Cloud connected 叢集代管所在 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。
  • NODEPOOL_ID:可識別這個節點集區的專屬程式化 ID。
  • REQUEST_ID:用於識別這項要求的專屬程式輔助 ID。
  • POOL_NAME:可清楚識別這個節點集區的專屬名稱。
  • LABELS:要套用至這個節點集區資源的標籤清單。
  • ZONE_NAME:目標 Distributed Cloud 連結區域的名稱。這個區域必須位於 REGION 中指定的區域。
  • NODE_COUNT:這個節點集區擁有的節點數量。
  • MACHINE_FILTER (選用):指定機器選取的篩選條件。只有符合這個篩選條件的機器才能加入這個節點集區。如果是多機架叢集,請使用這個標記指定 Distributed Cloud connected 機架,這些機架的節點會組成這個節點集區。
  • KMS_KEY (選用):要用於這個節點集區的 Cloud KMS 金鑰完整路徑。例如:

    /projects/myProject/locations/us-west1-a/keyRings/myKeyRing/cryptoKeys/myGDCE-Key
    

    只有在您已整合 Distributed Cloud connected 與 Cloud Key Management Service 時,這個參數才適用,如「為本機儲存空間啟用客戶自行管理的加密金鑰 (CMEK) 支援」一文所述。

刪除節點集區

如要刪除 Distributed Cloud 節點集區,請完成本節中的步驟。

如要完成這項工作,您必須在 Google Cloud 專案中擁有Edge Container 管理員角色roles/edgecontainer.admin

gcloud

使用 gcloud edge-cloud container clusters node-pools delete 指令:

gcloud edge-cloud container clusters node-pools delete POOL_NAME \
    --project=PROJECT_ID \
    --location=REGION \
    --cluster=CLUSTER_NAME

更改下列內容:

  • POOL_NAME:目標節點集區的名稱。
  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:與這個節點集區相關聯的 Distributed Cloud connected 叢集代管所在 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。

API

projects.locations.clusters.nodePools.delete 方法發出 DELETE 要求:

DELETE /v1/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME/nodePools/POOL_NAME?requestId=REQUEST_ID

更改下列內容:

  • PROJECT_ID:目標 Google Cloud 專案的 ID。
  • REGION:與這個節點集區相關聯的 Distributed Cloud connected 叢集代管所在 Google Cloud 區域。
  • CLUSTER_NAME:目標 Distributed Cloud 連結叢集的名稱。
  • POOL_NAME:目標節點集區的名稱。
  • REQUEST_ID:用於識別這項要求的專屬程式輔助 ID。

後續步驟