Kubernetes 提供了一款命令列工具,用於透過 Kubernetes API 與 Kubernetes 叢集的控制平面 (control plane) 進行通訊。
此工具名為 kubectl。
在設定方面,kubectl 會預設在 $HOME/.kube 目錄下尋找名為 config 的檔案。您可以透過設定 KUBECONFIG 環境變數,或使用 --kubeconfig 旗標來指定其他的 kubeconfig 檔案。
本概述介紹了 kubectl 語法、指令操作說明,並提供了常見範例。有關每個指令的詳細資訊(包括所有支援的旗標與子指令),請參閱 kubectl 參考文件。
如需總覽,請參閱 kubectl 命令列工具。有關安裝說明,請參閱 安裝 kubectl;如需快速指南,請參閱 速查表 (cheat sheet)。如果您習慣使用 docker 命令列工具,給 Docker 使用者的 kubectl 一文說明了部分對應的 Kubernetes 指令。
請使用下列語法從您的終端機視窗執行 kubectl 指令
kubectl [command] [TYPE] [NAME] [flags]
其中 command(指令)、TYPE(資源類型)、NAME(資源名稱)與 flags(旗標)說明如下
command:指定您要在一個或多個資源上執行的操作,例如 create、get、describe、delete。
TYPE:指定資源類型。資源類型不分大小寫,您可以指定單數、複數或縮寫形式。例如,下列指令產生的輸出結果相同
kubectl get pod pod1
kubectl get pods pod1
kubectl get po pod1
NAME:指定資源的名稱。名稱區分大小寫。如果省略名稱,則會顯示該類型所有資源的詳細資訊,例如 kubectl get pods。
當對多個資源執行操作時,您可以依類型與名稱指定每個資源,或是指定一個或多個檔案
若要依類型與名稱指定資源
若要對同類型的多個資源進行分組:TYPE1 name1 name2 name<#>。
範例:kubectl get pod example-pod1 example-pod2
若要分別指定多個資源類型:TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>。
範例:kubectl get pod/example-pod1 replicationcontroller/example-rc1
若要使用一個或多個檔案來指定資源:-f file1 -f file2 -f file<#>
kubectl get -f ./pod.yamlflags:指定選用旗標。例如,您可以使用 -s 或 --server 旗標來指定 Kubernetes API 伺服器的位址與連接埠。
如果您需要協助,請在終端機視窗執行 kubectl help。
預設情況下,kubectl 會先判斷它是否在 Pod 內執行(即在叢集內)。它會先檢查是否存在 KUBERNETES_SERVICE_HOST 與 KUBERNETES_SERVICE_PORT 環境變數,以及在 /var/run/secrets/kubernetes.io/serviceaccount/token 是否存在服務帳戶權杖 (service account token) 檔案。如果這三者都存在,則會自動採用叢集內驗證。
為了保持向後相容性,如果在叢集內驗證期間設定了 POD_NAMESPACE 環境變數,它將會覆寫來自服務帳戶權杖的預設命名空間。任何依賴於命名空間預設值的資訊清單或工具都會受到影響。
POD_NAMESPACE 環境變數
如果設定了 POD_NAMESPACE 環境變數,則針對命名空間資源的 CLI 操作將預設使用該變數的值。例如,如果該變數設定為 seattle,則 kubectl get pods 會傳回 seattle 命名空間中的 Pod。這是因為 Pod 屬於命名空間資源,且指令中未提供命名空間。請檢視 kubectl api-resources 的輸出結果,以確定某個資源是否屬於命名空間。
明確使用 --namespace <value> 會覆寫此行為。
kubectl 如何處理 ServiceAccount 權杖
如果
/var/run/secrets/kubernetes.io/serviceaccount/token,並且KUBERNETES_SERVICE_HOST 環境變數,並且KUBERNETES_SERVICE_PORT 環境變數,並且那麼 kubectl 會假設它正在您的叢集內執行。kubectl 工具會查詢該 ServiceAccount 的命名空間(這與 Pod 的命名空間相同)並對該命名空間進行操作。這與在叢集外執行的行為不同;當 kubectl 在叢集外執行且您未指定命名空間時,kubectl 指令會對用戶端設定檔中目前內容 (context) 所設定的命名空間進行操作。若要變更 kubectl 的預設命名空間,您可以使用下列指令
kubectl config set-context --current --namespace=<namespace-name>
下表包含所有 kubectl 操作的簡短說明與通用語法
| 操作 | 語法 | 描述 |
|---|---|---|
Alpha | kubectl alpha SUBCOMMAND [flags] | 列出與 alpha 特性對應的可執行指令,這些特性在 Kubernetes 叢集中預設未啟用。 |
annotate | kubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags] | 新增或更新一個或多個資源的註釋 (annotations)。 |
api-resources | kubectl api-resources [flags] | 列出可用的 API 資源。 |
api-versions | kubectl api-versions [flags] | 列出可用的 API 版本。 |
apply | kubectl apply -f FILENAME [flags] | 透過檔案或 stdin 套用資源的設定變更。 |
attach | kubectl attach POD -c CONTAINER [-i] [-t] [flags] | 附加到正在執行的容器,以查看輸出串流或與容器互動 (stdin)。 |
auth | kubectl auth [flags] [options] | 檢查授權資訊。 |
autoscale | kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [flags] | 自動擴展由複製控制器 (replication controller) 管理的 Pod 集合。 |
certificate | kubectl certificate SUBCOMMAND [options] | 修改憑證資源。 |
cluster-info | kubectl cluster-info [flags] | 顯示叢集中 Master 節點與服務的端點資訊。 |
completion | kubectl completion SHELL [options] | 為指定的 Shell (bash 或 zsh) 輸出命令補全程式碼。 |
config | kubectl config SUBCOMMAND [flags] | 修改 kubeconfig 檔案。詳情請參閱各別子指令。 |
convert | kubectl convert -f FILENAME [options] | 在不同 API 版本之間轉換設定檔。接受 YAML 與 JSON 格式。注意:需要安裝 kubectl-convert 插件。 |
cordon | kubectl cordon NODE [options] | 將節點標記為不可排程。 |
cp | kubectl cp <file-spec-src> <file-spec-dest> [options] | 在容器之間複製檔案與目錄。 |
create | kubectl create -f FILENAME [flags] | 從檔案或 stdin 建立一個或多個資源。 |
delete | kubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags] | 從檔案、stdin 或透過指定標籤選擇器、名稱、資源選擇器或資源來刪除資源。 |
describe | kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags] | 顯示一個或多個資源的詳細狀態。 |
diff | kubectl diff -f FILENAME [flags] | 比較檔案或 stdin 與即時設定的差異。 |
drain | kubectl drain NODE [options] | 為維護準備清空節點。 |
edit | kubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags] | 使用預設編輯器編輯並更新伺服器上一個或多個資源的定義。 |
事件 | kubectl events | 列出事件 |
exec | kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]] | 在 Pod 中的容器執行指令。 |
explain | kubectl explain TYPE [--recursive=false] [flags] | 取得各種資源(例如 pods、nodes、services 等)的說明文件。 |
expose | kubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] [flags] | 將複製控制器、服務或 Pod 公開為新的 Kubernetes 服務。 |
get | kubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags] | 列出一個或多個資源。 |
kustomize | kubectl kustomize <dir> [flags] [options] | 列出由 kustomization.yaml 檔案中的說明所產生的一組 API 資源。參數必須是包含該檔案的目錄路徑,或是相對於儲存庫根目錄指定路徑的 Git 儲存庫 URL。 |
label | kubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags] | 新增或更新一個或多個資源的標籤 (labels)。 |
logs | kubectl logs POD [-c CONTAINER] [--follow] [flags] | 列印 Pod 中容器的日誌。 |
選項 | kubectl options | 全域命令列選項清單,適用於所有指令。 |
patch | kubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags] | 使用策略性合併修補 (strategic merge patch) 流程來更新資源的一個或多個欄位。 |
外掛程式 | kubectl plugin [flags] [options] | 提供用於與外掛程式互動的公用程式。 |
port-forward | kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags] | 將一個或多個本機連接埠轉送到 Pod。 |
proxy | kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags] | 執行指向 Kubernetes API 伺服器的代理伺服器。 |
replace | kubectl replace -f FILENAME | 從檔案或 stdin 取代資源。 |
rollout | kubectl rollout SUBCOMMAND [options] | 管理資源的捲動更新 (rollout)。有效的資源類型包括:deployments、daemonsets 與 statefulsets。 |
run | kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client|none] [--overrides=inline-json] [flags] | 在叢集上執行指定的映像檔。 |
scale | kubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags] | 更新指定複製控制器的規模。 |
設定 | kubectl set SUBCOMMAND [options] | 設定應用程式資源。 |
taint | kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options] | 更新一個或多個節點的污點。 |
top | kubectl top (POD | NODE) [flags] [options] | 顯示 Pod 或節點的資源使用量(CPU/記憶體/儲存空間)。 |
uncordon | kubectl uncordon NODE [options] | 將節點標記為可排程。 |
版本 | kubectl version [--client] [flags] | 顯示執行於用戶端與伺服器的 Kubernetes 版本。 |
wait | kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available] [options] | 實驗性:等待一個或多個資源達成特定條件。 |
若要進一步了解操作指令,請參閱 kubectl 參考文件。
下表包含所有支援的資源類型及其縮寫別名清單。
(此輸出可從 kubectl api-resources 取得,且準確度截至 Kubernetes 1.25.0)
| 名稱 | 縮寫名稱 | API 版本 | 命名空間支援 | 類型 (Kind) |
|---|---|---|---|---|
bindings | v1 | true | 綁定 | |
componentstatuses | cs | v1 | false | 元件狀態 |
configmaps | cm | v1 | true | ConfigMap |
endpoints | ep | v1 | true | 端點 |
事件 | ev | v1 | true | 事件 |
limitranges | limits | v1 | true | 限制範圍 |
namespaces | ns | v1 | false | 命名空間 |
nodes | no | v1 | false | 節點 |
persistentvolumeclaims | pvc | v1 | true | PersistentVolumeClaim |
persistentvolumes | pv | v1 | false | PersistentVolume |
Pod | po | v1 | true | Pod |
podtemplates | v1 | true | PodTemplate | |
replicationcontrollers | rc | v1 | true | ReplicationController |
resourcequotas | quota | v1 | true | 資源配額 |
secrets | v1 | true | 密鑰 | |
serviceaccounts | sa | v1 | true | ServiceAccount |
服務 (services) | svc | v1 | true | 服務 |
mutatingwebhookconfigurations | admissionregistration.k8s.io/v1 | false | 變更 Webhook 配置 | |
validatingwebhookconfigurations | admissionregistration.k8s.io/v1 | false | 驗證 Webhook 配置 | |
customresourcedefinitions | crd,crds | apiextensions.k8s.io/v1 | false | CustomResourceDefinition |
apiservices | apiregistration.k8s.io/v1 | false | APIService | |
controllerrevisions | apps/v1 | true | ControllerRevision | |
daemonsets | ds | apps/v1 | true | DaemonSet |
deployments | deploy | apps/v1 | true | 部署 |
replicasets | rs | apps/v1 | true | ReplicaSet |
statefulsets | sts | apps/v1 | true | StatefulSet |
tokenreviews | authentication.k8s.io/v1 | false | 令牌審核 | |
localsubjectaccessreviews | authorization.k8s.io/v1 | true | 本地主題存取審核 | |
selfsubjectaccessreviews | authorization.k8s.io/v1 | false | 自我主題存取審核 | |
selfsubjectrulesreviews | authorization.k8s.io/v1 | false | 自我主題規則審核 | |
subjectaccessreviews | authorization.k8s.io/v1 | false | 主題存取審核 | |
horizontalpodautoscalers | hpa | autoscaling/v2 | true | HorizontalPodAutoscaler |
cronjobs | cj | batch/v1 | true | CronJob |
jobs | batch/v1 | true | 工作 | |
certificatesigningrequests | csr | certificates.k8s.io/v1 | false | CertificateSigningRequest |
leases | coordination.k8s.io/v1 | true | 租約 | |
endpointslices | discovery.k8s.io/v1 | true | EndpointSlice | |
事件 | ev | events.k8s.io/v1 | true | 事件 |
flowschemas | flowcontrol.apiserver.k8s.io/v1beta2 | false | 流量模式 | |
prioritylevelconfigurations | flowcontrol.apiserver.k8s.io/v1beta2 | false | 優先級別配置 | |
ingressclasses | networking.k8s.io/v1 | false | IngressClass | |
ingresses | ing | networking.k8s.io/v1 | true | 進入 |
networkpolicies | netpol | networking.k8s.io/v1 | true | 網路策略 |
runtimeclasses | node.k8s.io/v1 | false | 執行時期類別 | |
poddisruptionbudgets | pdb | policy/v1 | true | PodDisruptionBudget |
podsecuritypolicies | psp | policy/v1beta1 | false | PodSecurityPolicy |
clusterrolebindings | rbac.authorization.k8s.io/v1 | false | 叢集角色綁定 | |
clusterroles | rbac.authorization.k8s.io/v1 | false | 叢集角色 | |
rolebindings | rbac.authorization.k8s.io/v1 | true | 角色綁定 | |
roles | rbac.authorization.k8s.io/v1 | true | 角色 | |
priorityclasses | pc | scheduling.k8s.io/v1 | false | PriorityClass |
csidrivers | storage.k8s.io/v1 | false | CSIDriver | |
csinodes | storage.k8s.io/v1 | false | CSINode | |
csistoragecapacities | storage.k8s.io/v1 | true | CSIStorageCapacity | |
storageclasses | sc | storage.k8s.io/v1 | false | StorageClass |
volumeattachments | storage.k8s.io/v1 | false | 儲存卷附件 |
請使用下列章節了解如何格式化或排序特定指令的輸出。有關哪些指令支援各種輸出選項的詳細資訊,請參閱 kubectl 參考文件。
所有 kubectl 指令的預設輸出格式為人類可讀的純文字格式。若要以特定格式將詳細資訊輸出至終端機視窗,您可以在支援的 kubectl 指令中新增 -o 或 --output 旗標。
kubectl [command] [TYPE] [NAME] -o <output_format>
根據 kubectl 操作,支援下列輸出格式
| 輸出格式 | 描述 |
|---|---|
-o custom-columns=<spec> | 使用逗號分隔的自訂欄位清單來列印表格。 |
-o custom-columns-file=<filename> | 使用 <filename> 檔案中的自訂欄位範本來列印表格。 |
-o json | 輸出 JSON 格式的 API 物件。 |
-o jsonpath=<template> | 列印由 jsonpath 表達式所定義的欄位。 |
-o jsonpath-file=<filename> | 列印由 <filename> 檔案中的 jsonpath 表達式所定義的欄位。 |
-o kyaml | 輸出 KYAML 格式的 API 物件 (beta)。 |
-o name | 僅列印資源名稱,不包含其他資訊。 |
-o wide | 以純文字格式輸出,包含任何額外的詳細資訊。對於 Pod,會包含節點名稱。 |
-o yaml | 輸出 YAML 格式的 API 物件。KYAML 是一種實驗性的 Kubernetes 專用 YAML 方言,可以作為 YAML 進行解析。 |
在此範例中,下列指令將單一 Pod 的詳細資訊輸出為 YAML 格式物件
kubectl get pod web-pod-13je7 -o yaml
記住:請參閱 kubectl 參考文件,以了解每個指令支援哪些輸出格式。
若要定義自訂欄位並僅將您需要的詳細資訊輸出為表格,您可以使用 custom-columns 選項。您可以選擇內嵌定義自訂欄位或使用範本檔案:-o custom-columns=<spec> 或 -o custom-columns-file=<filename>。
內嵌定義
kubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion
範本檔案
kubectl get pods <pod-name> -o custom-columns-file=template.txt
其中 template.txt 檔案包含
NAME RSRC
metadata.name metadata.resourceVersion
執行任一指令的結果類似於
NAME RSRC
submit-queue 610995
kubectl 支援從伺服器接收關於物件的特定欄位資訊。這意味著對於任何給定的資源,伺服器會傳回該資源相關的欄位與列,供用戶端列印。這使得針對同一叢集使用的不同用戶端,能擁有統一的人類可讀輸出,因為詳細的列印邏輯已由伺服器封裝。
此特性預設啟用。若要停用,請在 kubectl get 指令中新增 --server-print=false 旗標。
若要列印關於 Pod 狀態的資訊,請使用類似下列的指令
kubectl get pods <pod-name> --server-print=false
輸出類似於
NAME AGE
pod-name 1m
若要將物件以排序後的清單輸出至終端機視窗,您可以在支援的 kubectl 指令中新增 --sort-by 旗標。透過指定任何數值或字串欄位來排序您的物件。若要指定欄位,請使用 jsonpath 表達式。
kubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>
若要列印按名稱排序的 Pod 清單,請執行
kubectl get pods --sort-by=.metadata.name
使用下列範例組合來協助您熟悉常用 kubectl 操作的執行
kubectl apply - 從檔案或 stdin 套用或更新資源。
# Create a service using the definition in example-service.yaml.
kubectl apply -f example-service.yaml
# Create a replication controller using the definition in example-controller.yaml.
kubectl apply -f example-controller.yaml
# Create the objects that are defined in any .yaml, .yml, or .json file within the <directory> directory.
kubectl apply -f <directory>
kubectl get - 列出一個或多個資源。
# List all pods in plain-text output format.
kubectl get pods
# List all pods in plain-text output format and include additional information (such as node name).
kubectl get pods -o wide
# List the replication controller with the specified name in plain-text output format. Tip: You can shorten and replace the 'replicationcontroller' resource type with the alias 'rc'.
kubectl get replicationcontroller <rc-name>
# List all replication controllers and services together in plain-text output format.
kubectl get rc,services
# List all daemon sets in plain-text output format.
kubectl get ds
# List all pods running on node server01
kubectl get pods --field-selector=spec.nodeName=server01
kubectl describe - 顯示一個或多個資源的詳細狀態,預設包括未初始化的資源。
# Display the details of the node with name <node-name>.
kubectl describe nodes <node-name>
# Display the details of the pod with name <pod-name>.
kubectl describe pods/<pod-name>
# Display the details of all the pods that are managed by the replication controller named <rc-name>.
# Remember: Any pods that are created by the replication controller get prefixed with the name of the replication controller.
kubectl describe pods <rc-name>
# Describe all pods
kubectl describe pods
kubectl get 指令通常用於擷取一個或多個相同類型的資源。它具備豐富的旗標組合,例如允許您使用 -o 或 --output 旗標自訂輸出格式。您可以指定 -w 或 --watch 旗標來開始監看特定物件的更新。kubectl describe 指令則更專注於描述指定資源的許多相關面向。它可能會呼叫多次 API 伺服器來為使用者建立檢視畫面。例如,kubectl describe node 指令不僅會擷取關於節點的資訊,還會擷取節點上執行的 Pod 摘要、該節點產生的事件等。kubectl delete - 從檔案、stdin 或透過指定標籤選擇器、名稱、資源選擇器或資源來刪除資源。
# Delete a pod using the type and name specified in the pod.yaml file.
kubectl delete -f pod.yaml
# Delete all the pods and services that have the label '<label-key>=<label-value>'.
kubectl delete pods,services -l <label-key>=<label-value>
# Delete all pods, including uninitialized ones.
kubectl delete pods --all
kubectl exec - 在 Pod 中的容器執行指令。
# Get output from running 'date' from pod <pod-name>. By default, output is from the first container.
kubectl exec <pod-name> -- date
# Get output from running 'date' in container <container-name> of pod <pod-name>.
kubectl exec <pod-name> -c <container-name> -- date
# Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is from the first container.
kubectl exec -ti <pod-name> -- /bin/bash
kubectl logs - 列印 Pod 中容器的日誌。
# Return a snapshot of the logs from pod <pod-name>.
kubectl logs <pod-name>
# Start streaming the logs from pod <pod-name>. This is similar to the 'tail -f' Linux command.
kubectl logs -f <pod-name>
kubectl diff - 查看對叢集擬定更新的差異。
# Diff resources included in "pod.json".
kubectl diff -f pod.json
# Diff file read from stdin.
cat service.yaml | kubectl diff -f -
使用下列範例組合來協助您熟悉撰寫與使用 kubectl 插件
# create a simple plugin in any language and name the resulting executable file
# so that it begins with the prefix "kubectl-"
cat ./kubectl-hello
#!/bin/sh
# this plugin prints the words "hello world"
echo "hello world"
撰寫完插件後,讓我們使其變為可執行檔
chmod a+x ./kubectl-hello
# and move it to a location in our PATH
sudo mv ./kubectl-hello /usr/local/bin
sudo chown root:root /usr/local/bin
# You have now created and "installed" a kubectl plugin.
# You can begin using this plugin by invoking it from kubectl as if it were a regular command
kubectl hello
hello world
# You can "uninstall" a plugin, by removing it from the folder in your
# $PATH where you placed it
sudo rm /usr/local/bin/kubectl-hello
為了查看 kubectl 可用的所有插件,請使用 kubectl plugin list 子指令
kubectl plugin list
輸出類似於
The following kubectl-compatible plugins are available:
/usr/local/bin/kubectl-hello
/usr/local/bin/kubectl-foo
/usr/local/bin/kubectl-bar
kubectl plugin list 也會警告您關於不可執行或是被其他插件遮蔽 (shadowed) 的插件;例如
sudo chmod -x /usr/local/bin/kubectl-foo # remove execute permission
kubectl plugin list
The following kubectl-compatible plugins are available:
/usr/local/bin/kubectl-hello
/usr/local/bin/kubectl-foo
- warning: /usr/local/bin/kubectl-foo identified as a plugin, but it is not executable
/usr/local/bin/kubectl-bar
error: one plugin warning was found
您可以將插件視為在既有 kubectl 指令之上建立更複雜功能的手段
cat ./kubectl-whoami
接下來的幾個範例假設您已經將 kubectl-whoami 設定為包含以下內容
#!/bin/bash
# this plugin makes use of the `kubectl config` command in order to output
# information about the current user, based on the currently selected context
kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config current-context)'" }}Current user: {{ printf "%s\n" .context.user }}{{ end }}{{ end }}'
執行上述指令會產生包含您 KUBECONFIG 檔案中目前內容所屬使用者的輸出
# make the file executable
sudo chmod +x ./kubectl-whoami
# and move it into your PATH
sudo mv ./kubectl-whoami /usr/local/bin
kubectl whoami
Current user: plugins-user
kubectl 參考文件kubectl 使用規範