kubectl explain

摘要

描述各種資源的欄位和結構。

此命令描述與每個支援的 API 資源相關聯的欄位。欄位透過簡單的 JSONPath 識別碼識別

    <type>.<fieldName>[.<fieldName>]

每個欄位的資訊都以 OpenAPI 格式從伺服器擷取。

使用 "kubectl api-resources" 取得完整支援資源清單。

kubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2]

範例

  # Get the documentation of the resource and its fields
  kubectl explain pods
  
  # Get all the fields in the resource
  kubectl explain pods --recursive
  
  # Get the explanation for deployment in supported api versions
  kubectl explain deployments --api-version=apps/v1
  
  # Get the documentation of a specific field of a resource
  kubectl explain pods.spec.containers
  
  # Get the documentation of resources in different format
  kubectl explain deployment --output=plaintext-openapiv2

選項

--api-version 字串

使用給定的資源 api 版本 (群組/版本)。

-h, --help

explain 的說明

-o, --output 字串     預設值: "plaintext"

呈現結構描述的格式。有效值為: (plaintext, plaintext-openapiv2)。

--recursive

若為 true,則以遞迴方式列印所有欄位的名稱。否則,列印可用欄位及其描述。

--as 字串

要模擬以執行操作的使用者名稱。使用者可以是命名空間中的一般使用者或服務帳戶。

--as-group 字串

要模擬以執行操作的群組,可以重複此標誌以指定多個群組。

--as-uid 字串

要模擬以執行操作的 UID。

--cache-dir 字串     預設值: "$HOME/.kube/cache"

預設快取目錄

--certificate-authority 字串

憑證授權單位的憑證檔案路徑

--client-certificate 字串

TLS 用戶端憑證檔案的路徑

--client-key 字串

TLS 用戶端金鑰檔案的路徑

--cluster 字串

要使用的 kubeconfig 叢集名稱

--context 字串

要使用的 kubeconfig 內容名稱

--default-not-ready-toleration-seconds 整數     預設值: 300

表示預設新增至每個尚未具有此容忍度的 Pod 的 notReady:NoExecute 容忍度的 tolerationSeconds。

--default-unreachable-toleration-seconds 整數     預設值: 300

表示預設新增至每個尚未具有此容忍度的 Pod 的 unreachable:NoExecute 容忍度的 tolerationSeconds。

--disable-compression

若為 true,則選擇退出伺服器所有請求的回應壓縮

--insecure-skip-tls-verify

若為 true,則不會檢查伺服器的憑證是否有效。這會使您的 HTTPS 連線不安全

--kubeconfig 字串

用於 CLI 請求的 kubeconfig 檔案路徑。

--match-server-version

要求伺服器版本與用戶端版本相符

-n, --namespace string

如果存在,則此 CLI 請求的命名空間範圍

--password string

API 伺服器的基本身份驗證密碼

--profile string     Default: "none"

要擷取的設定檔名稱。選項之一 (none|cpu|heap|goroutine|threadcreate|block|mutex)

--profile-output string     Default: "profile.pprof"

要將設定檔寫入的檔案名稱

--request-timeout string     Default: "0"

在放棄單個伺服器請求之前等待的時間長度。非零值應包含對應的時間單位 (例如 1 秒、2 分、3 小時)。值為零表示請求永不逾時。

-s, --server string

Kubernetes API 伺服器的位址和端口

--storage-driver-buffer-duration duration     Default: "1m0s"

儲存驅動程式中的寫入將在此持續時間內緩衝,並作為單個交易提交到非記憶體後端

--storage-driver-db string     Default: "cadvisor"

資料庫名稱

--storage-driver-host string     Default: "localhost:8086"

資料庫主機:端口

--storage-driver-password string     Default: "root"

資料庫密碼

--storage-driver-secure

使用與資料庫的安全連線

--storage-driver-table string     Default: "stats"

表格名稱

--storage-driver-user string     Default: "root"

資料庫使用者名稱

--tls-server-name string

用於伺服器憑證驗證的伺服器名稱。如果未提供,則使用用於聯絡伺服器的主機名稱

--token string

用於 API 伺服器身份驗證的 Bearer 令牌

--user string

要使用的 kubeconfig 使用者名稱

--username string

API 伺服器的基本身份驗證使用者名稱

--version version[=true]

--version、--version=raw 列印版本資訊並退出;--version=vX.Y.Z... 設定回報的版本

--warnings-as-errors

將從伺服器收到的警告視為錯誤,並以非零退出代碼退出

參見

  • kubectl - kubectl 控制 Kubernetes 叢集管理器

此頁面為自動產生。

如果您計劃回報此頁面的問題,請在您的問題描述中提及此頁面為自動產生。修復可能需要在 Kubernetes 專案的其他地方進行。

上次修改時間 2024 年 12 月 12 日下午 2:44 PST:更新 v1.32 的 kubectl 參考 (5c2cfa02af)