監控資源


如要取得資源相關資訊,您可以使用 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
當設定連接器資源的對應作業失敗時,就會發生此錯誤。
DependencyNotReady
當參照的 Config Connector 資源尚未就緒時,就會發生這個錯誤。您可以查看資源的狀態,判斷資源是否就緒。
DependencyNotFound
找不到參照的 Config Connector 資源或 Kubernetes 密鑰時發生。
DependencyInvalid
參考檔案無效時發生。舉例來說,假設 Config Connector 資源參照 Kubernetes 密鑰。如果 Secret 存在,但不包含所參照的鍵,則該參照會視為無效。
刪除中
當 Config Connector 資源從 Kubernetes API 伺服器中刪除時,就會觸發此事件。
已刪除
當 Config Connector 資源已成功從 Kubernetes API 伺服器中刪除時,就會觸發此事件。
DeleteFailed
當從 Kubernetes API 伺服器刪除 Config Connector 資源失敗時,就會發生此錯誤。
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 就會開始管理資源。

後續步驟