anthos-gke aws clusters 中的指令會對 AWS 上的 GKE 使用者叢集執行操作。您可以使用 get-credentials 指令,向使用者叢集進行驗證。您也可以使用 diagnose 指令,收集其他資訊來偵錯。
Get-credentials
get-credentials 指令會使用 GKE on AWS 使用者叢集的憑證和端點資訊,更新 kubeconfig 檔案。根據預設,憑證會附加至 ~/.kube/config。如果將 KUBECONFIG 環境變數設為其他檔案路徑,anthos-gke 會將憑證附加至該檔案。
anthos-gke aws clusters get-credentials NAME [--workspace DIRECTORY]
位置引數
- NAME
- 名稱應與
AWSCluster資源的metadata.name欄位一致。
anthos-gke 產生憑證的叢集名稱。選用旗標
--workspace [DIRECTORY]- 選用引數,用於指定包含
anthos-gke.yaml檔案的目錄。預設為目前目錄。
範例
如要取得目前使用的目錄中定義的叢集 cluster-0 憑證,請執行下列指令:
anthos-gke aws clusters get-credentials cluster-0
診斷
diagnose snapshot 指令會產生支援套件,協助 Google Cloud 支援團隊偵錯使用者叢集的問題。支援套件是 tar 檔案,內含設定、叢集事件和記錄。將這個檔案傳送給技術支援經理。
anthos-gke aws clusters diagnose snapshot CLUSTER_NAME
--ssh-key-path PATH
[--bastion-ip IP]
[--bastion-ssh-key-path PATH]
[--cluster-ssh-key-path PATH]
[--dry-run]
[--mgmt-service-ssh-key-path PATH]
[--nodepool-ssh-key-path PATH]
[--output PATH]
[--quiet]
[--snapshot-config PATH]
[--workspace DIRECTORY]
位置引數
CLUSTER_NAME- 要產生支援套件的叢集名稱。這個值應與
AWSCluster的metadata.name欄位相符。
旗標
--ssh-key-path PATH- :必要引數,用於提供安全殼層金鑰檔案的路徑。如果您使用
anthos-gke management init建立金鑰,這個值會是~/.ssh/anthos-gke。
選用旗標
[--bastion-ip IP]- 覆寫目前工作區中的堡壘主機 IP 位址。
[--bastion-ssh-key-path PATH]- 堡壘主機的特定安全殼層金鑰檔案。預設值為
--ssh-key-path。 [--cluster-ssh-key-path PATH]- 工作負載叢集控制層機器的特定安全殼層金鑰檔案。預設值為
--ssh-key-path。 [--dry-run]- 顯示快照設定檔,但不產生支援套件。
[--mgmt-service-ssh-key-path PATH]- 代管服務專用的安全殼層金鑰檔案。預設值為
--ssh-key-path。 [--nodepool-ssh-key-path PATH]- 節點集區機器的特定安全殼層金鑰檔案。預設值為
--ssh-key-path。 [--output PATH]- 支援套件 tarball 的檔案路徑。
[--quiet]- 可選擇不將訊息輸出至控制台。
[--snapshot-config PATH]- YAML 快照設定檔的路徑 (選用)。
[--workspace DIR]- 工作區目錄,應包含
anthos-gke.yaml設定檔。預設為目前目錄。
範例
如要為名為 cluster-0 的工作負載叢集產生支援套件,請執行下列指令:
anthos-gke aws clusters diagnose snapshot cluster-0 \
--ssh-key-path ~/.ssh/anthos-gke \
--workspace ~/example/workspace
如要查看預設快照設定,請執行下列指令:
anthos-gke aws clusters diagnose snapshot cluster-0 \
--ssh-key-path ~/.ssh/anthos-gke \
--dry-run
如要指定自訂快照設定檔 (包括您自己的 bash 和 kubectl 指令),請執行下列指令:
anthos-gke aws clusters diagnose snapshot cluster-0 \
--ssh-key-path ~/.ssh/anthos-gke
--snapshot-config ~/my-snapshot-config.yaml