kubectl 命令set 設置值

 

https://jimmysong.io/kubernetes-handbook/guide/using-kubectl.html
零、Options 選項
https://www.kubernetes.org.cn/doc-45
功能: 使用kubectl來管理Kubernetes集羣。
可以在 https://github.com/kubernetes/kubernetes 找到更多的信息。
選項:
--kubeconfig="": 命令行請求使用的配置文件路徑。
--api-version="": 和服務端交互使用的API版本。
--certificate-authority="": 用以進行認證授權的.cert文件路徑。
--client-certificate="": TLS使用的客戶端證書路徑。
--client-key="": TLS使用的客戶端密鑰路徑。
--cluster="": 指定使用的kubeconfig配置文件中的集羣名。
--context="": 指定使用的kubeconfig配置文件中的環境名。
--user="": 指定使用的kubeconfig配置文件中的用戶名。
--insecure-skip-tls-verify[=false]: 如果爲true,將不會檢查服務器憑證的有效性,這會導致你的HTTPS鏈接變得不安全。
--match-server-version[=false]: 要求服務端和客戶端版本匹配。
--namespace="": 如果不爲空,命令將使用此namespace。
--token="": 認證到API Server使用的令牌。
-s, --server="": Kubernetes API Server的地址和端口號。
--username="": API Server進行簡單認證使用的用戶名。
--password="": API Server進行簡單認證使用的密碼。
--log-dir="": 如果不爲空,將日誌文件寫入此目錄。
--log-flush-frequency=5s: 刷新日誌的最大時間間隔。
--v=0: 指定輸出日誌的級別。
--vmodule=: 指定輸出日誌的模塊,格式如下:pattern=N,使用逗號分隔。
--log-backtrace-at=:0: 當日志長度超過定義的行數時,忽略堆棧信息。
--stderrthreshold=2: 高於此級別的日誌將被輸出到錯誤控制檯。
--logtostderr[=true]: 輸出日誌到標準錯誤控制檯,不輸出到文件。
--alsologtostderr[=false]: 同時輸出日誌到標準錯誤控制檯和文件。

一、Basic Commands (Beginner)基本命令(初學者)
1.kubectl create命令
http://docs.kubernetes.org.cn/490.html
功能:通過配置文件名或stdin創建一個集羣資源對象。支持JSON和YAML格式的文件。
語法:kubectl create -f object.yaml/json
資源對象類型包括:
configmap
namespace
deployment
quota
secrete
service
serviceaccount
示例:
通過pod.json文件創建一個pod。
kubectl create -f ./pod.json
通過stdin的JSON創建一個pod。
cat pod.json | kubectl create -f -
API版本爲v1的JSON格式的docker-registry.yaml文件創建資源。
kubectl create -f docker-registry.yaml --edit --output-version=v1 -o json
選項說明:

2.kubectl expose命令
http://docs.kubernetes.org.cn/475.html
功能:將資源暴露爲新的Kubernetes Service
資源包括(不區分大小寫):pod(po),service(svc),replication controller(rc),deployment(deploy),replica set(rs)
語法:
$ expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]
選項說明:

3.kubectl run命令
http://docs.kubernetes.org.cn/468.html
功能:創建並運行一個或多個容器鏡像;創建一個deployment 或job 來管理容器。
語法:
$ run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]
示例:
啓動nginx實例。
kubectl run nginx --image=nginx
啓動hazelcast實例,暴露容器端口 5701。
kubectl run hazelcast --image=hazelcast --port=5701
啓動hazelcast實例,在容器中設置環境變量“DNS_DOMAIN = cluster”和“POD_NAMESPACE = default”。
kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
啓動nginx實例,設置副本數5。
kubectl run nginx --image=nginx --replicas=5
運行 Dry 打印相應的API對象而不創建它們。
kubectl run nginx --image=nginx --dry-run
選項說明:

4.kubectl set命令
http://docs.kubernetes.org.cn/669.html
功能:配置應用資源,使用這些命令能幫你更改現有應用資源一些信息。
語法:
$ set SUBCOMMAND
子命令:
4.1 image
http://docs.kubernetes.org.cn/670.html
功能:更新現有的資源對象的容器鏡像。
可使用資源對象包括(不區分大小寫):
pod (po)、replicationcontroller (rc)、deployment (deploy)、daemonset (ds)、job、replicaset (rs)
語法:
$ image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N
示例
將deployment中的nginx容器鏡像設置爲“nginx:1.9.1”。
kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1
所有deployment和rc的nginx容器鏡像更新爲“nginx:1.9.1”
kubectl set image deployments,rc nginx=nginx:1.9.1 --all
將daemonset abc的所有容器鏡像更新爲“nginx:1.9.1”
kubectl set image daemonset abc *=nginx:1.9.1
從本地文件中更新nginx容器鏡像
kubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml
選項說明:

4.2 resources
http://docs.kubernetes.org.cn/671.html
功能:資源對象中的Pod可以指定計算資源需求(CPU-單位m、內存-單位Mi),即使用的最小資源請求(Requests),限制(Limits)的最大資源需求,Pod將保證使用在設置的資源數量範圍。
Requests:計算資源最小數量。
Limits:資源最大允許數量。
對於每個Pod資源,如果指定了Limits(限制)值,並省略了Requests(請求),則Requests默認爲Limits的值。
可用資源對象包括(支持大小寫):replicationcontroller、deployment、daemonset、job、replicaset。
語法:
$ resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]
示例:
將deployment的nginx容器cpu限制爲“200m”,將內存設置爲“512Mi”
kubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi
爲nginx中的所有容器設置 Requests和Limits
kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
刪除nginx中容器的計算資源值
kubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
打印從本地更新nginx容器限制的結果(以yaml格式),而不會觸發服務器。打印結果(以yaml格式),在不影響服務器的情況下,從本地更新nginx容器限制
kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml

4.3 selector
http://docs.kubernetes.org.cn/672.html
功能:設置資源的selector(選擇器)。
如果在調用"set selector"命令之前已經存在選擇器,則新創建的選擇器將覆蓋原來的選擇器。
selector必須以字母或數字開頭,最多包含63個字符,可使用:字母、數字、連字符" - " 、點"."和下劃線" _ "。
如果指定了--resource-version,則更新將使用此資源版本,否則將使用現有的資源版本。
注意:目前selector命令只能用於Service對象。
語法:
$ selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]
示例
在創建deployment/service對之前設置labels和selector。
kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
kubectl create deployment my-dep -o yaml --dry-run | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -

4.4 subject
http://docs.kubernetes.org.cn/681.html
功能:更新RoleBinding / ClusterRoleBinding中User、Group 或 ServiceAccount。
語法:subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]
示例:
更新一個ClusterRoleBinding 的 serviceaccount1
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1
更新RoleBinding的user1,user2和group1
kubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1

二、Basic Commands (Intermediate)基本命令(中間)
1.kubectl get命令
http://docs.kubernetes.org.cn/626.html
功能:獲取列出一個或多個資源的信息。
可以使用的資源包括:
all
certificatesigningrequests (aka 'csr')
clusterrolebindings
clusterroles
clusters (valid only for federation apiservers)
componentstatuses (aka 'cs')
configmaps (aka 'cm')
controllerrevisions
cronjobs
daemonsets (aka 'ds')
deployments (aka 'deploy')
endpoints (aka 'ep')
events (aka 'ev')
horizontalpodautoscalers (aka 'hpa')
ingresses (aka 'ing')
jobs
limitranges (aka 'limits')
namespaces (aka 'ns')
networkpolicies (aka 'netpol')
nodes (aka 'no')
persistentvolumeclaims (aka 'pvc')
persistentvolumes (aka 'pv')
poddisruptionbudgets (aka 'pdb')
podpreset
pods (aka 'po')
podsecuritypolicies (aka 'psp')
podtemplates
replicasets (aka 'rs')
replicationcontrollers (aka 'rc')
resourcequotas (aka 'quota')
rolebindings
roles
secrets
serviceaccounts (aka 'sa')
services (aka 'svc')
statefulsets
storageclasses
thirdpartyresources

語法:
$ get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]
kubectl get 資源類型
資源類型包括:
pods(po)
replicationcontrollers(rc) 副本控制
replicasets(rs) 副本集
deployments(deploy) 部署
statefulsets 有狀態的集合
daemonsets(ds) 守護進程集合
jobs 定時器
horizontalpodautoscalers(hpa) Pod水平自動擴展

nodes(no) 節點
namespaces(ns) 命名空間
services(svc) 服務
secrets 機密
configmaps(cm) 配置映射
ingresses(ing) 入口
thirdpartyresources 第三方資源
serviceaccounts(sa) 服務賬戶

persistentvolumes(pv) 持久卷
persistentvolumeclaims(pvc) 持久卷聲明
storadeclasses 存儲類

resourcequotas(quota) 資源配額
limitranges(limits) 限制範圍

podtemplates Pod模板
podsecuritypolicies(psp) Pod安全策略
componentstatuses(cs) 組件狀態
networkpolicies 網絡策略
clusters 集羣
events(ev) 事件
endpoints(ep) 終端
示例:
exp1: 列出所有運行的Pod信息。
kubectl get pods
exp2: 列出Pod以及運行Pod節點信息。
kubectl get pods -o wide
exp3: 列出指定NAME的 replication controller信息。
kubectl get replicationcontroller web
exp4: 以JSON格式輸出一個pod信息。
kubectl get -o json pod web-pod-13je7
exp5: 以“pod.yaml”配置文件中指定資源對象和名稱輸出JSON格式的Pod信息。
kubectl get -f pod.yaml -o json
exp6: 返回指定pod的相位值。
kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
exp7: 列出所有replication controllers和service信息。
kubectl get rc,services
exp8: 按其資源和名稱列出相應信息。
kubectl get rc/web service/frontend pods/web-pod-13je7
exp9: 列出所有不同的資源對象。
kubectl get all
選項說明:
--all-namespaces:false If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
--allow-missing-template-keys:true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
--experimental-use-openapi-print-columns:false If true, use x-kubernetes-print-column metadata (if present) from openapi schema for displaying a resource.
--export:false If true, use 'export' for the resources. Exported resources are stripped of cluster-specific information.
--filename/-f:[] Filename, directory, or URL to files identifying the resource to get from a server.
--ignore-not-found:false Treat "resource not found" as a successful retrieval.
--include-extended-apis:true If true, include definitions of new APIs via calls to the API server. [default true]
--label-columns/-L:[] Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2...
--no-headers:false When using the default or custom-column output format, don't print headers (default print headers).
--output/-o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].
--output-version DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob').
--raw Raw URI to request from the server. Uses the transport specified by the kubeconfig file.
--recursive/-R:false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--schema-cache-dir:~/.kube/schema If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
--selector/-l Selector (label query) to filter on, supports '=', '==', and '!='.
--show-all/-a:false When printing, show all resources (default hide terminated pods.)
--show-kind:false If present, list the resource type for the requested object(s).
--show-labels:false When printing, show all labels as the last column (default hide labels column)
--sort-by If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--template Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--watch/-w:false After listing/getting the requested object, watch for changes.
--watch-only:false Watch for changes to the requested object(s), without listing/getting first.

2.kubectl explain命令
功能:資源文檔
語法:
示例:

3.kubectl edit命令
https://www.kubernetes.org.cn/doc-62
功能:編輯服務端的資源。
使用系統默認編輯器編輯服務端的資源。
edit命令允許你直接編輯使用命令行工具獲取的任何資源。
此命令將打開你通過KUBE_EDITOR,GIT_EDITOR 或者EDITOR環境變量定義的編輯器,或者直接使用“vi”。
你可以同時編輯多個資源,但所有的變更都只會一次性提交。
除了命令行參數外,此命令也接受文件名,但所直指定的文件必須使用早於當前的資源版本。
所編輯的文件將使用默認的API版本輸出,或者通過–output-version選項顯式指定。
默認的輸出格式是YAML, 如果你需要使用JSON格式編輯,使用-o json選項。
如果當更新資源的時候出現錯誤,將會在磁盤上創建一個臨時文件,記錄未成功的更新。
更新資源時最常見的錯誤是其他人也在更新服務端的資源。
當這種情況發生時,你需要將你所作的更改應用到最新版本的資源上,或者編輯保存的臨時文件,使用最新的資源版本。
語法:kubectl edit (RESOURCE/NAME | -f FILENAME)
示例:
exp1: 編輯名爲“docker-registry”的service
$ kubectl edit svc/docker-registry
exp2: 使用一個不同的編輯器
$ KUBE_EDITOR="nano" kubectl edit svc/docker-registry
exp3: 編輯名爲“docker-registry”的service,使用JSON格式、v1 API版本
$ kubectl edit svc/docker-registry --output-version=v1 -o json
選項說明:
-f, --filename=[]: 用來指定待編輯資源的文件名,目錄名或者URL。
-o, --output="yaml": 輸出格式,可選yaml或者json中的一種。
--output-version="": 輸出資源使用的API版本(默認使用api-version)。

4.kubectl delete命令
http://docs.kubernetes.org.cn/618.html
功能:
通過配置文件名、stdin、資源名稱或label選擇器來刪除資源。
支持JSON和YAML格式文件。可以只指定一種類型的參數:文件名、資源名稱或label選擇器。
有些資源,如pod,支持優雅的(graceful)刪除,因爲這些資源一般是集羣中的實體,所以刪除不可能會立即生效,這些資源在強制終止之前默認定義了一個週期(寬限期),但是你可以使用--grace-period flag來覆蓋該值,或者通過pass --now設置該週期爲1。
如果託管Pod的Node節點已經停止或者無法連接API Server,使用delete命令刪除Pod需等待時間更長。要強制刪除資源,需指定- force flag,且設置週期(寬限期)爲0。
如果執行強制刪除Pod,則調度程序會在節點釋放這些Pod之前將新的Pod放在這些節點上,並使之前Pod立即被逐出。
注意:執行delete命令時不會檢查資源版本,如果在執行delete操作時有人進行了更新操作,那麼更新操作將連同資源一起被刪除。
語法:
$ delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])
示例:
exp1: 使用 pod.json中指定的資源類型和名稱刪除pod。
kubectl delete -f ./pod.json
exp2: 根據傳入stdin的JSON所指定的類型和名稱刪除pod。
cat pod.json | kubectl delete -f -
exp3: 刪除名爲“baz”和“foo”的Pod和Service。
kubectl delete pod,service baz foo
exp4: 刪除 Label name = myLabel的pod和Service。
kubectl delete pods,services -l name=myLabel
exp5: 強制刪除dead node上的pod
kubectl delete pod foo --grace-period=0 --force
exp6: 刪除所有pod
kubectl delete pods --all
選項說明:

三、Deploy Commands 部署命令
1.kubectl rollout命令
http://docs.kubernetes.org.cn/643.html
功能:對資源進行管理
可用資源包括:deployments、daemonsets
語法:
$ rollout SUBCOMMAND
子命令:
1.1 history(查看歷史版本)
http://docs.kubernetes.org.cn/645.html
功能:查看之前推出的版本(歷史版本)。
語法:
kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]
示例:
exp1: 查看deployment的歷史記錄
kubectl rollout history deployment/abc
exp2: 查看daemonset修訂版3的詳細信息
kubectl rollout history daemonset/abc --revision=3
選項說明:
--filename/-f=[] Filename, directory, or URL to files identifying the resource to get from a server.
--recursive/-R=false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--revision=0 See the details, including podTemplate of the revision specified

1.2 pause(暫停資源)
http://docs.kubernetes.org.cn/647.html
功能:
將提供的資源標記爲暫停
被pause命令暫停的資源不會被控制器協調使用,可以是“kubectl rollout resume”命令恢復已暫停資源。
目前僅支持的資源:deployments。
語法:
kubectl rollout pause RESOURCE
示例:
將deployment標記爲暫停。#只要deployment在暫停中,使用deployment更新將不會生效。
kubectl rollout pause deployment/nginx
選項說明:
--filename/-f=[] Filename, directory, or URL to files identifying the resource to get from a server.
--recursive/-R=false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.

1.3 resume(恢復暫停資源)
http://docs.kubernetes.org.cn/650.html
功能:恢復已暫停的資源
被pause命令暫停的資源將不會被控制器協調使用。可以通過resume來恢復資源。目前僅支持恢復deployment資源。
語法:
kubectl rollout resume RESOURCE
示例:
恢復已暫停的 deployment
kubectl rollout resume deployment/nginx
選項說明:
--filename/-f=[] Filename, directory, or URL to files identifying the resource to get from a server.
--recursive/-R=false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.

1.4 status(查看資源狀態)
http://docs.kubernetes.org.cn/652.html
功能:查看資源的狀態。
使用--watch = false 來查看當前狀態,需要查看特定修訂版本狀態 請使用--revision = N 來指定。
語法:$ status (TYPE NAME | TYPE/NAME) [flags]
示例:查看deployment的狀態
kubectl rollout status deployment/nginx
選項說明:
--filename/-f=[] Filename, directory, or URL to files identifying the resource to get from a server.
--recursive/-R=false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--revision=0 See the details, including podTemplate of the revision specified
--watch/-w=true Watch the status of the rollout until it's done.

1.5 undo(回滾版本)
http://docs.kubernetes.org.cn/654.html
功能:回滾到之前的版本。
語法:$ undo (TYPE NAME | TYPE/NAME) [flags]
示例:
exp1: 回滾到之前的deployment
kubectl rollout undo deployment/abc
kubectl rollout undo --dry-run=true deployment/abc
回滾到daemonset 修訂3版本
kubectl rollout undo daemonset/abc --to-revision=3
選項說明:
--dry-run=false If true, only print the object that would be sent, without sending it.
--filename/-f=[] Filename, directory, or URL to files identifying the resource to get from a server.
--recursive/-R=false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--to-revision=0 The revision to rollback to. Default to 0 (last revision).

2.kubectl rolling-update命令
http://docs.kubernetes.org.cn/638.html
功能:執行指定ReplicationController的滾動更新。
該命令創建了一個新的RC, 然後一次更新一個pod方式逐步使用新的PodTemplate,最終實現Pod滾動更新,new-controller.json需要與之前RC在相同的namespace下。
語法:$ rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)
示例:
exp1: 使用frontend-v2.json中的新RC數據更新frontend-v1的pod。
kubectl rolling-update frontend-v1 -f frontend-v2.json
exp2: 使用JSON數據更新frontend-v1的pod。
cat frontend-v2.json | kubectl rolling-update frontend-v1 -f -
exp3:
kubectl rolling-update frontend-v1 frontend-v2 --image=image:v2
kubectl rolling-update frontend --image=image:v2
kubectl rolling-update frontend-v1 frontend-v2 --rollback
選項說明:

3.kubectl scale命令
http://docs.kubernetes.org.cn/664.html
功能:擴容或縮容 Deployment、ReplicaSet、Replication Controller或 Job 中Pod數量。
scale也可以指定多個前提條件,如:當前副本數量或 --resource-version ,進行伸縮比例設置前,系統會先驗證前提條件是否成立。
語法:$ scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)
示例:
exp1: 將名爲foo中的pod副本數設置爲3。
kubectl scale --replicas=3 rs/foo
exp2: 將由“foo.yaml”配置文件中指定的資源對象和名稱標識的Pod資源副本設爲3。
kubectl scale --replicas=3 -f foo.yaml
exp3: 如果當前副本數爲2,則將其擴展至3。
kubectl scale --current-replicas=2 --replicas=3 deployment/mysql
exp4: 設置多個RC中Pod副本數量。
kubectl scale --replicas=5 rc/foo rc/bar rc/baz
選項說明:

4.kubectl autoscale命令
http://docs.kubernetes.org.cn/486.html
功能:使用 autoscaler 自動設置在kubernetes集羣中運行的pod數量(水平自動伸縮)。
指定Deployment、ReplicaSet或ReplicationController,並創建已經定義好資源的自動伸縮器。
使用自動伸縮器可以根據需要自動增加或減少系統中部署的pod數量。
語法:$ autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]
示例:
exp1: 使用 Deployment “foo”設定,使用默認的自動伸縮策略,指定目標CPU使用率,使其Pod數量在2到10之間。
kubectl autoscale deployment foo --min=2 --max=10
exp2: 使用RC“foo”設定,使其Pod的數量介於1和5之間,CPU使用率維持在80%。
kubectl autoscale rc foo --max=5 --cpu-percent=80
選項說明:

四、Cluster Management Commands集羣管理命令
1.kubectl certificate命令
功能:修改證書資源。

2.kubectl cluster-info命令
https://www.kubernetes.org.cn/doc-50
功能:顯示集羣信息。
語法:kubectl cluster-info

3.kubectl top命令
功能:展示資源 (CPU/Memory/Storage) 使用信息。
語法:kubectl top node|pod
4.kubectl cordon命令
功能:將 node 節點標記爲不可調度

5.kubectl uncordon命令
功能:標記 node 節點爲可調度

6.kubectl drain命令
功能:爲便於維護,需要提前驅逐node節點

7.kubectl taint命令
功能:更新一個或多個 node 節點的污點信息

五、Settings Commands 設置命令
1.kubectl lable命令
http://docs.kubernetes.org.cn/628.html
功能:更新(增加、修改或刪除)資源上的 label(標籤)。
label 必須以字母或數字開頭,可以使用字母、數字、連字符、點和下劃線,最長63個字符。
如果--overwrite 爲 true,則可以覆蓋已有的 label,否則嘗試覆蓋 label 將會報錯。
如果指定了--resource-version,則更新將使用此資源版本,否則將使用現有的資源版本。
語法:$ label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
示例:
exp1: 給名爲foo的Pod添加label unhealthy=true。
kubectl label pods foo unhealthy=true
exp2: 給名爲foo的Pod修改label 爲 'status' / value 'unhealthy',且覆蓋現有的value。
kubectl label --overwrite pods foo status=unhealthy
exp3: 給 namespace 中的所有 pod 添加 label
kubectl label pods --all status=unhealthy
exp4: 僅當resource-version=1時才更新名爲foo的Pod上的label。
kubectl label pods foo status=unhealthy --resource-version=1
exp5: 刪除名爲“bar”的label 。(使用“ - ”減號相連)
kubectl label pods foo bar-
選項說明:

2.kubectl annotate命令
http://docs.kubernetes.org.cn/477.html
功能:更新一個或多個資源的Annotations信息。
Annotations由key/value組成。
Annotations的目的是存儲輔助數據,特別是通過工具和系統擴展操作的數據,更多介紹在這裏。
如果--overwrite爲true,現有的annotations可以被覆蓋,否則試圖覆蓋annotations將會報錯。
如果設置了--resource-version,則更新將使用此resource version,否則將使用原有的resource version
有效資源類型包括:
all
certificatesigningrequests (aka 'csr')
clusterrolebindings
clusterroles
clusters (valid only for federation apiservers)
componentstatuses (aka 'cs')
configmaps (aka 'cm')
controllerrevisions
cronjobs
daemonsets (aka 'ds')
deployments (aka 'deploy')
endpoints (aka 'ep')
events (aka 'ev')
horizontalpodautoscalers (aka 'hpa')
ingresses (aka 'ing')
jobs
limitranges (aka 'limits')
namespaces (aka 'ns')
networkpolicies (aka 'netpol')
nodes (aka 'no')
persistentvolumeclaims (aka 'pvc')
persistentvolumes (aka 'pv')
poddisruptionbudgets (aka 'pdb')
podpreset
pods (aka 'po')
podsecuritypolicies (aka 'psp')
podtemplates
replicasets (aka 'rs')
replicationcontrollers (aka 'rc')
resourcequotas (aka 'quota')
rolebindings
roles
secrets
serviceaccounts (aka 'sa')
services (aka 'svc')
statefulsets
storageclasses
thirdpartyresources
語法:$ annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
示例:
exp1: 更新Pod“foo”,設置annotation “description”的value “my frontend”,如果同一個annotation多次設置,則只使用最後設置的value值。
kubectl annotate pods foo description='my frontend'
exp2: 根據“pod.json”中的type和name更新pod的annotation
kubectl annotate -f pod.json description='my frontend'
exp3: 更新Pod"foo",設置annotation“description”的value“my frontend running nginx”,覆蓋現有的值。
kubectl annotate --overwrite pods foo description='my frontend running nginx'
exp4: 更新 namespace中的所有pod
kubectl annotate pods --all description='my frontend running nginx'
exp5: 只有當resource-version爲1時,才更新pod ' foo '。
kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
exp6: 通過刪除名爲“description”的annotations來更新pod ' foo '。#不需要- overwrite flag。
kubectl annotate pods foo description-
選項說明:

3.kubectl completion命令

六、Troubleshooting and Debugging Commands 故障排除和調試命令
1.kubectl describe命令
https://www.kubernetes.org.cn/doc-61
功能:輸出指定的一個/多個資源的詳細信息。
此命令組合調用多條API,輸出指定的一個或者一組資源的詳細描述。
$ kubectl describe TYPE NAME_PREFIX
首先檢查是否有精確匹配TYPE和NAME_PREFIX的資源,如果沒有,將會輸出所有名稱以NAME_PREFIX開頭的資源詳細信息。
支持的資源包括但不限於(大小寫不限):pods (po)、services (svc)、 replicationcontrollers (rc)、nodes (no)、events (ev)、componentstatuses (cs)、 limitranges (limits)、persistentvolumes (pv)、persistentvolumeclaims (pvc)、 resourcequotas (quota)和secrets。
語法:
kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)
示例:
exp1: 描述一個node
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
exp2: 描述一個pod
$ kubectl describe pods/nginx
exp3: 描述pod.json中的資源類型和名稱指定的pod
$ kubectl describe -f pod.json
exp4: 描述所有的pod
$ kubectl describe pods
exp5: 描述所有包含label name=myLabel的pod
$ kubectl describe po -l name=myLabel
exp6: 描述所有被replication controller “frontend”管理的pod(rc創建的pod都以rc的名字作爲前綴)
$ kubectl describe pods frontend
選項說明:
-f, --filename=[]: 用來指定待描述資源的文件名,目錄名或者URL。
-l, --selector="": 用於過濾資源的Label。

2.kubectl logs命令
https://www.kubernetes.org.cn/doc-64
功能:輸出pod中一個容器的日誌。
輸出pod中一個容器的日誌。如果pod只包含一個容器則可以省略容器名。
語法:kubectl logs [-f] [-p] POD [-c CONTAINER]
示例:
exp1: 返回僅包含一個容器的pod nginx的日誌快照
$ kubectl logs nginx
exp2: 返回pod ruby中已經停止的容器web-1的日誌快照
$ kubectl logs -p -c ruby web-1
exp3: 持續輸出pod ruby中的容器web-1的日誌
$ kubectl logs -f -c ruby web-1
exp4: 僅輸出pod nginx中最近的20條日誌
$ kubectl logs --tail=20 nginx
exp5: 輸出pod nginx中最近一小時內產生的所有日誌
$ kubectl logs --since=1h nginx
選項說明:
-c, --container="": 容器名。
-f, --follow[=false]: 指定是否持續輸出日誌。
--interactive[=true]: 如果爲true,當需要時提示用戶進行輸入。默認爲true。
--limit-bytes=0: 輸出日誌的最大字節數。默認無限制。
-p, --previous[=false]: 如果爲true,輸出pod中曾經運行過,但目前已終止的容器的日誌。
--since=0: 僅返回相對時間範圍,如5s、2m或3h,之內的日誌。默認返回所有日誌。只能同時使用since和since-time中的一種。
--since-time="": 僅返回指定時間(RFC3339格式)之後的日誌。默認返回所有日誌。只能同時使用since和since-time中的一種。
--tail=-1: 要顯示的最新的日誌條數。默認爲-1,顯示所有的日誌。
--timestamps[=false]: 在日誌中包含時間戳。

3.kubectl attach命令
https://www.kubernetes.org.cn/doc-49
功能:
連接到一個正在運行的容器。
連接到現有容器中一個正在運行的進程。
語法:
kubectl attach POD -c CONTAINER
示例:
exp1: 獲取正在運行中的pod 123456-7890的輸出,默認連接到第一個容器
$ kubectl attach 123456-7890
exp2: 獲取pod 123456-7890中ruby-container的輸出
$ kubectl attach 123456-7890 -c ruby-container date
exp3: 切換到終端模式,將控制檯輸入發送到pod 123456-7890的ruby-container的“bash”命令,並將其輸出到控制檯,錯誤控制檯的信息發送回客戶端。
$ kubectl attach 123456-7890 -c ruby-container -i -t
選項
-c, --container="": 容器名。
-i, --stdin[=false]: 將控制檯輸入發送到容器。
-t, --tty[=false]: 將標準輸入控制檯作爲容器的控制檯輸入。

4.kubectl exec命令
https://www.kubernetes.org.cn/doc-63
功能:在容器內部執行命令。
語法:kubectl exec POD [-c CONTAINER] -- COMMAND [args...]
示例:
exp1: 默認在pod 123456-7890的第一個容器中運行“date”並獲取輸出
$ kubectl exec 123456-7890 date
exp2: 在pod 123456-7890的容器ruby-container中運行“date”並獲取輸出
$ kubectl exec 123456-7890 -c ruby-container date
exp3: 切換到終端模式,將控制檯輸入發送到pod 123456-7890的ruby-container的“bash”命令,並將其輸出到控制檯/
# 錯誤控制檯的信息發送回客戶端。
$ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
選項
-c, --container="": 容器名。如果未指定,使用pod中的一個容器。
-p, --pod="": Pod名。
-i, --stdin[=false]: 將控制檯輸入發送到容器。
-t, --tty[=false]: 將標準輸入控制檯作爲容器的控制檯輸入。

5.kubectl port-forward命令
功能:
語法:kubectl port-forward
選項:
示例:

6.kubectl proxy命令
功能:創建一個代理服務器,或者一個應用程序網關。
語法:kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [options]
選項:
示例:

7.kubectl cp命令
功能:從容器向外拷貝文件或目錄,或者向容器內拷貝文件或目錄。
語法:kubectl cp <file-spec-src> <file-spec-dest> [options]
選項:
-c, --container='': 指定容器名。如果未指定時,則默認指定Pod內的第一個容器。
--no-preserve=false: 拷貝文件的所有者和權限保存/不保存在容器中。
示例:
exp1: 向容器內拷貝目錄
kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir
exp2: 向指定容器內拷貝文件
kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>
exp3: 向指定命名空間下的容器內拷貝文件
kubectl cp /tmp/foo <some-pod>:/tmp/bar -n <some-namespace>
exp4: 將指定命名空間下容器內的文件拷貝到本地
kubectl cp <some-pod>:/tmp/bar /tmp/foo -n <some-namespace>

8.kubectl auth命令
功能:Inspect authorization檢查授權
語法:kubectl auth

七、Advanced Commands高級命令
1.kubectl patch命令
http://docs.kubernetes.org.cn/632.html
功能:使用(patch)補丁修改、更新資源的字段。支持JSON和YAML格式。
語法:kubectl patch (-f FILENAME | TYPE NAME) -p PATCH
示例:
exp1: 使用patch更新Node節點。
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
exp2: 使用patch更新由“node.json”文件中指定的類型和名稱標識的節點
kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}'
exp3: 更新容器的鏡像
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
選項:
--allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
-f, --filename=[]: Filename, directory, or URL to files identifying the resource to update
--include-extended-apis=true: If true, include definitions of new APIs via calls to the API server. [default true]
--local=false: If true, patch will operate on the content of the file, not the server-side resource.
--no-headers=false: When using the default or custom-column output format, don't print headers (default print headers).
-o, --output: Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].
--output-version : DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob').
-p, --patch: The patch to be applied to the resource JSON file.
--record=false: Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
-R, --recursive=false: Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
-a, --show-all=false: When printing, show all resources (default hide terminated pods.)
--show-labels=false: When printing, show all labels as the last column (default hide labels column)
--sort-by: If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--template: Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--type=strategic: The type of patch being provided; one of [json merge strategic]

2.kubectl replace命令
http://docs.kubernetes.org.cn/635.html
功能:使用配置文件或stdin來替換資源。支持JSON和YAML格式。
如果替換當前資源,則必須提供完整的資源規範。完整的資源規範可以通過以下命令獲取:kubectl get TYPE NAME -o yaml
語法:kubectl replace -f FILENAME
示例:
exp1: 使用pod.json中的數據替換pod。
kubectl replace -f ./pod.json
exp2: 根據傳入的JSON替換pod。
cat pod.json | kubectl replace -f -
exp3: 更新鏡像版本(tag)到v4
kubectl get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
exp4: 強制替換,刪除原有資源,然後重新創建資源
kubectl replace --force -f ./pod.json
選項:
--cascade=false: Only relevant during a force replace. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController).
-f, --filename=[]: Filename, directory, or URL to files to use to replace the resource.
--force=false: Delete and re-create the specified resource
--grace-period=-1: Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.
--include-extended-apis=true: If true, include definitions of new APIs via calls to the API server. [default true]
-o, --output: Output mode. Use "-o name" for shorter output (resource/name).
--record =false: Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
-R, --recursive=false: Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--save-config=false: If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
--schema-cache-dir=~/.kube/schema: If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
--timeout=0s: Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
--validate=true: If true, use a schema to validate the input before sending it

3.kubectl convert命令
http://docs.kubernetes.org.cn/488.html
功能:
轉換配置文件爲不同的API版本,支持YAML和JSON格式。
該命令將配置文件名,目錄或URL作爲輸入,並將其轉換爲指定的版本格式,如果目標版本未指定或不支持,則轉換爲最新版本。
默認輸出將以YAML格式打印出來,可以使用- o選項改變輸出格式。
語法:kubectl convert -f FILENAME
示例:
exp1: 將“pod.yaml”轉換爲最新版本並打印到stdout。
kubectl convert -f pod.yaml
exp2: 將“pod.yaml”指定的資源的實時狀態轉換爲最新版本#,並以json格式打印到stdout。
kubectl convert -f pod.yaml --local -o json
exp3: 將當前目錄下的所有文件轉換爲最新版本,並將其全部創建。
kubectl convert -f . | kubectl create -f -
選項:
--allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
-f, --filename=[]: Filename, directory, or URL to files to need to get converted.
--include-extended-apis=true: If true, include definitions of new APIs via calls to the API server. [default true]
--local=true: If true, convert will NOT try to contact api-server but run locally.
--no-headers=false: When using the default or custom-column output format, don't print headers (default print headers).
-o, --output: Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].
--output-version : Output the formatted object with the given group version (for ex: 'extensions/v1beta1').)
-R, --recursive=false: Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--schema-cache-dir=~/.kube/schema: If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
-a, --show-all=false: When printing, show all resources (default hide terminated pods.)
--show-labels=false: When printing, show all labels as the last column (default hide labels column)
--sort-by: If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--template: Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--validate=true: If true, use a schema to validate the input before sending it

4.kubectl apply命令
https://blog.csdn.net/bbwangj/article/details/82011678
功能:通過文件名或控制檯輸入,對資源進行配置。接受JSON和YAML格式的描述文件。
語法:kubectl apply -f FILENAME
示例:
exp1: 將pod.json中的配置應用到pod
$ kubectl apply -f ./pod.json
exp2: 將控制檯輸入的JSON配置應用到Pod
$ cat pod.json | kubectl apply -f
選項:
-f, --filename=[]: 包含配置信息的文件名,目錄名或者URL。
-o, --output="": 輸出格式,使用“-o name”來輸出簡短格式(資源類型/資源名)。
--schema-cache-dir="/tmp/kubectl.schema": 如果不爲空,將API schema緩存爲指定文件,默認緩存到“/tmp/kubectl.schema”。
--validate[=true]: 如果爲true,在發送到服務端前先使用schema來驗證輸入

5.kubectl diff命令
功能:比較當前配置和文件內的配置信息的差異
語法:kubectl diff -f FILENAME [options]
選項:
-f, --filename=[]:
-R, --recursive=false:
示例:
kubectl diff -f pod.json
cat service.yaml | kubectl diff -f -

6.kubectl wait命令
功能:
語法:
kubectl wait resource.group/name [--for=delete | --for condition=available] [options]
選項:
--all-namespaces=false:
--allow-missing-template-keys=true:
-f, --filename=[]:
-o, --output='':
-R, --recursive=true:
-l, selectot='':
--template='':
--timeout=30s:
示例:
kubectl wait --for=condition=Ready pod/busybox1
kubectl delete pod/busybox1
kubectl wait --for=delete pod/busybox1 --timeout=60s

八、Other Commands其他命令
1.kubectl api-resources命令
功能:顯示該服務器上支持的API資源
語法:kubectl api-resources [選項]
選項:
--api-group='': Limit to resources in the specified API group
--cached=false: Use the cached list of resources if available 使用緩存的資源列表(如果可用)
--namespaced=true: 通過命名空間來限定資源, 取值:true,false,默認true。true指輸出命名空間內的資源,false指輸出不在命名空間內的資源。
--no-headers=false: 是否輸出標題(擡頭)信息。默認輸出。
-o, --output='': 輸出格式,取值:wide,name。wide指詳細信息,name指只輸出名稱。
--verbs=[]: 根據支持的動作來過濾資源,動作包括:create delete deletecollection get list patch update watch
示例:
exp1: 顯示支持的API資源
kubectl api-resources
exp2: 顯示支持的API資源及更多信息
kubectl api-resources -o wide
exp3: 顯示命名空間的API資源
kubectl api-resources --namespaced=true
exp4: 顯示命名空間以外的API資源
kubectl api-resources --namespaced=false
exp5: 顯示指定api-group的API資源
kubectl api-resources --api-group=extensions
exp6: 顯示同時支持create和get動作的API資源
kubectl api-resources --verbs=create --verbs=get -o wide

2.kubectl api-versions命令
https://www.kubernetes.org.cn/doc-47
功能:以“組/版本”的格式輸出服務端支持的API版本。
語法:kubectl api-versions

3.kubectl config命令
https://www.kubernetes.org.cn/doc-51
功能:修改kubeconfig配置文件。
使用config的子命令修改kubeconfig配置文件,如“kubectl config set current-context my-context”。
配置文件的讀取遵循如下規則:
如果指定了--kubeconfig選項,那麼只有指定的文件被加載。此選項只能被設置一次,並且不會合並其他文件。If the --kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes place.
如果設置了$KUBECONFIG環境變量,將同時使用此環境變量指定的所有文件列表(使用操作系統默認的順序),所有文件將被合併。
當修改一個值時,將修改設置了該值的文件。當創建一個值時,將在列表的首個文件創建該值。
若列表中所有的文件都不存在,將創建列表中的最後一個文件。
如果前兩項都沒有設置,將使用 ${HOME}/.kube/config,並且不會合並其他文件。
語法:kubectl config SUBCOMMAND
選項
--kubeconfig="": 使用特定的配置文件。‘
子命令:
current-context :顯示current-context
delete-cluster :從kubeconfig中刪除指定cluster
delete-context :從kubeconfig中刪除指定context
get-clusters :顯示kubeconfig中定義的cluster
get-contexts :顯示kubeconfig中定義的context
rename-contexts :重命名kubeconfig中的context
set :在kubeconfig中設置一個單獨的值
set-cluster :kubeconfig中設置cluster
set-context :kubeconfig中設置context
set-credentials :kubeconfig中設置用戶
unset :在kubeconfig中取消一個單獨的值
use-context :kubeconfig中設置當前context
view :顯示指定kubeconfig文件或合併kubeconfig設置

2.1 kubectl config current-context :顯示current-context
2.2 kubectl config delete-cluster :從kubeconfig中刪除指定cluster
2.3 kubectl config delete-context :從kubeconfig中刪除指定context
2.4 kubectl config get-clusters :顯示kubeconfig中定義的cluster
2.5 kubectl config get-contexts :顯示kubeconfig中定義的context
2.6 kubectl config rename-contexts :重命名kubeconfig中的context
2.7 kubectl config set :在kubeconfig中設置一個單獨的值
2.8 kubectl config set-cluster :kubeconfig中設置cluster
2.9 kubectl config set-context :kubeconfig中設置context
2.10 kubectl config set-credentials :kubeconfig中設置用戶
2.11 kubectl config unset :在kubeconfig中取消一個單獨的值
2.12 kubectl config use-context :kubeconfig中設置當前context
2.13 kubectl config view :顯示指定kubeconfig文件或合併kubeconfig設置

4.kubectl plugin命令

5.kubectl version命令
https://www.kubernetes.org.cn/doc-65
功能:輸出服務端和客戶端的版本信息。
語法:kubectl version
選項:
--client[=false]: 僅輸出客戶端版本(無需連接服務器)。
--short[=false]: 僅輸出版本號
-o,--output[=yaml/json]: 設置輸出格式

6.kubectl help命令
https://blog.csdn.net/snail0li/article/details/79281123
功能:獲得特定命令的幫助信息。
語法:
kubectl
kubectl help
kubectl --help
kubectl 子命令 --help

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章