本頁說明如何在 Distributed Cloud 區域中,建立及管理 Google Distributed Cloud 節點集區資源。
如要進一步瞭解 Distributed Cloud 節點集區,請參閱「Distributed Cloud 的運作方式」。
建立節點集區
如要建立 Distributed Cloud 節點集區,請完成本節中的步驟。
如要完成這項工作,您必須在Google Cloud 專案中具備下列角色:
- Edge Container 管理員角色
(
roles/edgecontainer.admin) Edge Container 機器使用者角色 (
roles/edgecontainer.machineUser)如果專案與Google Cloud 您要建立節點集區的專案不同,您也必須在 Google Cloud 專案中擁有這個角色,該專案包含要指派給這個節點集區的 Distributed 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 \
--machine-filter=MACHINE_FILTER \
--local-disk-kms-key=POOL_KMS_KEY
更改下列內容:
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:這個節點集區擁有的節點數量。MACHINE_FILTER(選用):指定機器選取的篩選條件。如要查看可篩選的欄位,請參閱「取得機器相關資訊」。只有符合這個篩選條件的機器才能加入這個節點集區。POOL_KMS_KEY(選用):要用於這個節點集區的 Cloud KMS 金鑰完整路徑。例如:/projects/myProject/locations/us-west1-a/keyRings/myKeyRing/cryptoKeys/myGDCE-Key
只有在您已按照「為本機儲存空間啟用客戶自行管理的加密金鑰 (CMEK) 支援功能」一文的說明,將 Distributed Cloud 與 Cloud Key Management Service 整合時,這個標記才適用。
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,
"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:這個節點集區擁有的節點數量。MACHINE_FILTER(選用):指定機器選取的篩選條件。只有符合這個篩選條件的機器才能加入這個節點集區。POOL_KMS_KEY(選用):要用於這個節點集區的 Cloud KMS 金鑰完整路徑。例如:/projects/myProject/locations/us-west1-a/keyRings/myKeyRing/cryptoKeys/myGDCE-Key
如要使用這個參數,您必須按照「為本機儲存空間啟用客戶自行管理的加密金鑰 (CMEK) 支援」一文所述,將 Distributed Cloud 與 Cloud Key Management Service 整合。
列出節點集區
如要列出 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 叢集的 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 叢集所在 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 叢集所在 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
更改下列內容:
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 叢集所在 Google Cloud 區域。CLUSTER_NAME:目標 Distributed Cloud 叢集的名稱。NODEPOOL_ID:可識別這個節點集區的專屬程式化 ID。REQUEST_ID:用於識別這項要求的專屬程式輔助 ID。POOL_NAME:可清楚識別這個節點集區的專屬名稱。LABELS:要套用至這個節點集區資源的標籤清單。ZONE_NAME:目標 Distributed Cloud 可用區的名稱。這個區域必須位於REGION中指定的區域。NODE_COUNT:這個節點集區擁有的節點數量。MACHINE_FILTER(選用):指定機器選取的篩選條件。只有符合這個篩選條件的機器才能加入這個節點集區。KMS_KEY(選用):要用於這個節點集區的 Cloud KMS 金鑰完整路徑。例如:/projects/myProject/locations/us-west1-a/keyRings/myKeyRing/cryptoKeys/myGDCE-Key
如要使用這個參數,您必須按照「為本機儲存空間啟用客戶自行管理的加密金鑰 (CMEK) 支援」一文所述,將 Distributed Cloud 與 Cloud Key Management Service 整合。
刪除節點集區
如要刪除 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 叢集所在 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 叢集所在 Google Cloud 區域。CLUSTER_NAME:目標 Distributed Cloud 叢集的名稱。POOL_NAME:目標節點集區的名稱。REQUEST_ID:用於識別這項要求的專屬程式輔助 ID。