apigeectl 是指令列介面 (CLI),可用於在 Kubernetes 叢集中安裝及管理 Apigee hybrid。如要瞭解如何下載及安裝 apigeectl,請參閱「下載及安裝 apigeectl」。
  套用 apigeectl 的範圍
  您可以使用 apigeectl 標記控制指令套用設定變更的範圍。如需 Apigee Hybrid 執行階段內範圍的總覽,請參閱「執行階段服務設定總覽」。
| 範圍 | 元件 | apigeectl標記 | 
|---|---|---|
| 儲存空間 | Cassandra | ‑‑datastore | 
| 記憶體儲存空間 | Redis | ‑‑redis | 
| 環境 | 執行階段 Synchronizer UDCA | ‑‑all‑envs‑‑env | 
| 機構 | Apigee Connect 代理人 MART Watcher | ‑‑org | 
| 報告 | 記錄器 指標 | ‑‑telemetry | 
apigeectl 語法
apigeectl [command] [flags]
其中:
- command:指定要執行的作業。如需完整的指令清單,請參閱 apigeectl 指令。 
- flags:指定指令參數。如需完整的旗標清單,請參閱 apigeectl 旗標。 
apigeectl 指令
下表列出 apigeectl 指令:
| 指令 | 說明 | 
|---|---|
| apply | 將 Apigee hybrid 執行階段元件的設定套用至 Kubernetes 叢集。 
 
        apigeectl 標記:  | 
| check‑ready | 檢查混合元件 Pod 的狀態。當所有元件 Pod 都就緒時,系統會輸出「All containers ready」訊息。針對自動化指令碼,請注意,當所有容器都就緒時,指令會以 0 的狀態結束。如果至少有一個 Pod 未就緒,指令會以狀態 1 結束。 
        apigeectl 標記:  | 
| delete | 從叢集中刪除混合式元件。使用  
 
         
        apigeectl 標記:  | 
| diagnostic | 叫用 Diagnostic 收集器,可視需要擷取 Apigee 混合式執行個體的 Kubernetes 元件診斷資料,並將這些資料儲存在 Google Cloud Storage 值區中。 診斷收集器需要具備名稱的 Google Cloud Storage 值區、具有 Storage 管理員角色的服務帳戶,以及新增至  當您叫用診斷收集器時,它會建立「 叫用診斷收集器: apigeectl diagnostic ‑f OVERRIDES_FILE 刪除診斷收集器: apigeectl diagnostic delete ‑f OVERRIDES_FILE 
        apigeectl 標記:
         | 
| encode | 傳回指定機構或指定機構內指定環境的所有 ApigeeDeployment 的編碼名稱清單。經過編碼的名稱包含元件名稱,以及機構的雜湊名稱 (如果使用  您必須使用  ./apigeectl encode ‑‑org hybrid‑example List of ApigeeDeployments are: apigee‑connect‑agent‑hybrid‑example‑6a82f8a apigee‑mart‑hybrid‑example‑6a82f8a apigee‑watcher‑hybrid‑example‑6a82f8a ./apigeectl encode ‑‑org hybrid‑example ‑‑env example‑env List of ApigeeDeployments are: apigee‑runtime‑hybrid‑example‑example‑env‑9e87e2d apigee‑synchronizer‑hybrid‑example‑example‑env‑9e87e2d apigee‑udca‑hybrid‑example‑example‑env‑9e87e2d 
        apigeectl 標記:  | 
| help | 列印線上說明。 | 
| init | 在 apigee‑system 命名空間中安裝 Apigee Operator 和 CRD。 
        請先安裝或升級後再執行  
        apigeectl 標記:  | 
| version | 列印 CLI 版本資訊。 
        apigeectl 標記:  | 
apigeectl 標記
下表列出 apigeectl 旗標:
| 旗標 | 說明 | 
|---|---|
| ‑‑all | delete專用:刪除叢集中的整個 Apigee 混合式安裝作業,但會保留 ASM (Istio) 和 cert-manager。 | 
| ‑‑all‑envs | 將  | 
| ‑‑datastore | 將設定套用至資料儲存庫範圍 (Cassandra)。 | 
| ‑‑dry‑run | 執行指定指令,但不變更叢集。搭配 ‑‑print‑yaml使用,將算繪物件規格輸出至檔案。
         
 | 
| ‑‑env env‑name | 將設定套用至指定的環境。這個標記會將設定套用至環境範圍元件 apigee‑runtime、apigee‑synchronizer 和 apigee‑udca。 
         apigeectl apply ‑‑org hybrid‑example ‑‑env example‑env \
      ‑f overrides/overrides.yaml | 
| ‑f | 指定包含混合式部署自訂設定屬性的 YAML 檔案。預設值為 ./overrides.yaml。apply、check‑ready、delete和init指令需要覆寫檔案。您必須使用這個標記指定完整路徑。詳情請參閱「管理執行階段平面元件」。 | 
| ‑h | 顯示指令的說明。 | 
| ‑‑org | 將設定套用至指定的機構。這個標記會將設定套用至機構範圍元件 apigee‑connect‑agent、apigee‑mart 和 apigee‑watcher。 | 
| ‑‑print‑yaml | 將設定範本輸出內容列印到標準輸出。如需使用此標記的範例,請參閱「將設定列印到檔案」。 | 
| ‑‑redis | 將設定套用至記憶體內資料儲存範圍 (Redis)。 | 
| ‑‑restore | 將 Cassandra 還原至先前儲存的快照,該快照是由  | 
| ‑s | 指定指令適用的設定。目前,這項標記僅支援  舉例來說,如果您在覆寫檔案中變更  apigeectl apply ‑f my‑overrides.yaml ‑‑settings virtualhosts \
    ‑‑org example‑org ‑‑env example‑env | 
| ‑‑telemetry | 為 apigee-logger 和 apigee-metrics 等遙測元件套用設定。 | 
| ‑‑v int | 將詳細記錄列印至標準錯誤。 ‑‑verbose選項。 | 
示例
初始化叢集設定
  請使用 init,將必要元件設定套用至叢集。您必須先執行 init 指令,再執行 apply。
apigeectl init ‑f my_overrides.yaml
套用叢集設定
如要將混合型設定套用至 Kubernetes 叢集,請使用 apply 指令。您第一次執行 apply 時,所有混合式執行階段元件都會在叢集中建立。如果您變更設定,請重新執行 apply,只套用變更,或使用標記只將變更套用至特定範圍。
以下範例將混合型執行階段平面元件的設定套用至叢集:
apigeectl apply ‑f my_overrides.yaml
為單一元件套用設定
如要將 apply 指令限制在特定元件,請使用 apigeectl 標記中所述的標記。
以下範例只會套用 Cassandra 元件的設定:
apigeectl apply ‑‑datastore ‑f my_overrides.yaml
將設定列印到檔案
如果您要對安裝問題進行偵錯,建議您將整個叢集設定列印到檔案中,以便檢查設定。‑‑print‑yaml 標記會將混合型設定列印到標準輸出,而 ‑‑dry‑run 標記則可讓指令在未對叢集進行任何變更的情況下執行。
apigeectl apply ‑f my_overrides.yaml ‑‑dry‑run=client ‑‑print‑yaml > apigee‑hybrid.yaml
檢查 Pod 狀態
以下範例會檢查部署至叢集的 Pod 狀態:
apigeectl check‑ready ‑f overrides/overrides.yaml All containers ready in namespace 'my-namespace'
從叢集中刪除混合型
以下範例只會刪除 Kubernetes 叢集的混合式執行階段元件。如要刪除所有資料,請使用 ‑‑all 標記。
apigeectl delete ‑f my_overrides.yaml