監控資源

如要取得資源相關資訊,可以使用 kubectl

事前準備

如要完成這些步驟,您需要現有的 Config Connector 資源。 如需資源範例,請參閱「開始使用 Config Connector」。

列出所有資源

如要列出 Config Connector 管理的資源,請執行下列指令:

kubectl get gcp

判斷資源狀態

您可以查看資源的 status.condition,判斷資源是否已就緒。Config Connector 會更新狀態,反映資源的目前狀態。

kubectl wait --for=condition=READY KIND NAME

更改下列內容:

  • KIND:資源的種類。例如:PubSubTopic
  • NAME:資源名稱

檢視活動

Config Connector 會建立 Kubernetes 事件,其中包含管理資源的相關資訊和錯誤。您可以查看特定資源的事件,或 Config Connector 環境中的所有事件。

查看單一資源的事件

如要查看單一資源的事件,請檢查下列指令輸出內容中的 Events 欄位:

kubectl describe KIND NAME

更改下列內容:

  • KIND:資源種類
  • NAME:資源名稱

舉例來說,如果您有名為 sqlinstance-sample 的 Config Connector SQLInstance 資源,請使用下列指令查看其事件:

kubectl describe sqlinstance sqlinstance-sample

查看命名空間的事件

如要查看特定命名空間中所有 Kubernetes 資源的事件 (包括 Config Connector 資源),請執行下列指令:

kubectl --namespace CC_NAMESPACE get events

CC_NAMESPACE 替換為 Config Connector 管理資源的命名空間。

Config Connector 專屬事件

Config Connector 可以建立下列事件類型:

更新中
當 Config Connector 資源的基礎 Google Cloud資源正在更新時,就會發生此事件。
UpToDate
:Config Connector 資源的協調程序成功時會發生。 這個事件類型表示基礎 Google Cloud 資源現在符合 Config Connector 資源指定的所需狀態。
UpdateFailed
當 Config Connector 資源的和解失敗時,就會發生這種情況。
DependencyNotReady
參考的 Config Connector 資源尚未就緒時會發生。您可以檢查資源狀態,判斷資源是否已就緒。
DependencyNotFound
找不到參照的 Config Connector 資源或 Kubernetes Secret 時,就會發生這個錯誤。
DependencyInvalid
參考檔案無效時會發生這種情況。舉例來說,假設 Config Connector 資源參照 Kubernetes Secret。如果 Secret 存在,但未包含參照的鍵,則參照無效。
刪除中
當 Config Connector 資源從 Kubernetes API 伺服器刪除時,就會發生這種情況。
已刪除
當 Config Connector 資源已從 Kubernetes API 伺服器成功刪除時,就會發生這種情況。
DeleteFailed
當 Config Connector 資源無法從 Kubernetes API 伺服器刪除時,就會發生這種情況。
ManagementConflict
當 Config Connector 資源無法取得基礎資源的所有權時,就會發生這種情況。 Google Cloud 發生這種情況時,通常是因為另一個 Config Connector 資源已擁有Google Cloud 資源。進一步瞭解 Config Connector 如何處理多個 Config Connector 資源之間的衝突
PreActuationTransformFailed
當 Config Connector 資源無法執行前啟動轉換時,就會發生這種情況。這個事件類型可能表示資源設定無效。
PostActuationTransformFailed
Config Connector 資源無法執行後續啟動轉換時,就會發生這個錯誤。
非代管

當 Config Connector 處於命名空間模式,且 Config Connector 資源位於未啟用 Config Connector 的命名空間 (也就是命名空間沒有 ConfigConnectorContext 物件) 時,就會發生這個錯誤。

即使命名空間有 ConfigConnectorContext,如果 ConfigConnectorContext 是在 Config Connector 資源建立前後建立,仍可能發生這個事件。您只需要等待一段時間,Config Connector 就會開始管理資源。

後續步驟