Skip to content

Commit 5d587b8

Browse files
authored
Merge pull request #42664 from tengqm/kubectl-reference
Add reference for kubectl command
2 parents 9e3193b + 028069c commit 5d587b8

File tree

113 files changed

+38537
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+38537
-3
lines changed

content/en/docs/reference/kubectl/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ files by setting the `KUBECONFIG` environment variable or by setting the
2121

2222
This overview covers `kubectl` syntax, describes the command operations, and provides common examples.
2323
For details about each command, including all the supported flags and subcommands, see the
24-
[kubectl](/docs/reference/generated/kubectl/kubectl-commands/) reference documentation.
24+
[kubectl](/docs/reference/kubectl/generated/kubectl/) reference documentation.
2525

2626
For installation instructions, see [Installing kubectl](/docs/tasks/tools/#kubectl);
2727
for a quick guide, see the [cheat sheet](/docs/reference/kubectl/quick-reference/).
@@ -582,7 +582,7 @@ Current user: plugins-user
582582

583583
* Read the `kubectl` reference documentation:
584584
* the kubectl [command reference](/docs/reference/kubectl/kubectl/)
585-
* the [command line arguments](/docs/reference/generated/kubectl/kubectl-commands/) reference
585+
* the [command line arguments](/docs/reference/kubectl/generated/kubectl/) reference
586586
* Learn about [`kubectl` usage conventions](/docs/reference/kubectl/conventions/)
587587
* Read about [JSONPath support](/docs/reference/kubectl/jsonpath/) in kubectl
588588
* Read about how to [extend kubectl with plugins](/docs/tasks/extend-kubectl/kubectl-plugins)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "kubectl reference"
3+
weight: 10
4+
---
5+
Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
---
2+
title: kubectl
3+
content_type: tool-reference
4+
weight: 30
5+
auto_generated: true
6+
---
7+
8+
9+
<!--
10+
The file is auto-generated from the Go source code of the component using a generic
11+
[generator](https://github.com/kubernetes-sigs/reference-docs/). To learn how
12+
to generate the reference documentation, please read
13+
[Contributing to the reference documentation](/docs/contribute/generate-ref-docs/).
14+
To update the reference content, please follow the
15+
[Contributing upstream](/docs/contribute/generate-ref-docs/contribute-upstream/)
16+
guide. You can file document formatting bugs against the
17+
[reference-docs](https://github.com/kubernetes-sigs/reference-docs/) project.
18+
-->
19+
20+
21+
## {{% heading "synopsis" %}}
22+
23+
24+
kubectl controls the Kubernetes cluster manager.
25+
26+
Find more information at: https://kubernetes.io/docs/reference/kubectl/
27+
28+
```
29+
kubectl [flags]
30+
```
31+
32+
## {{% heading "options" %}}
33+
34+
<table style="width: 100%; table-layout: fixed;">
35+
<colgroup>
36+
<col span="1" style="width: 10px;" />
37+
<col span="1" />
38+
</colgroup>
39+
<tbody>
40+
41+
<tr>
42+
<td colspan="2">--as string</td>
43+
</tr>
44+
<tr>
45+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Username to impersonate for the operation. User could be a regular user or a service account in a namespace.</p></td>
46+
</tr>
47+
48+
<tr>
49+
<td colspan="2">--as-group strings</td>
50+
</tr>
51+
<tr>
52+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Group to impersonate for the operation, this flag can be repeated to specify multiple groups.</p></td>
53+
</tr>
54+
55+
<tr>
56+
<td colspan="2">--as-uid string</td>
57+
</tr>
58+
<tr>
59+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>UID to impersonate for the operation.</p></td>
60+
</tr>
61+
62+
<tr>
63+
<td colspan="2">--azure-container-registry-config string</td>
64+
</tr>
65+
<tr>
66+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to the file containing Azure container registry configuration information.</p></td>
67+
</tr>
68+
69+
<tr>
70+
<td colspan="2">--cache-dir string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "$HOME/.kube/cache"</td>
71+
</tr>
72+
<tr>
73+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Default cache directory</p></td>
74+
</tr>
75+
76+
<tr>
77+
<td colspan="2">--certificate-authority string</td>
78+
</tr>
79+
<tr>
80+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to a cert file for the certificate authority</p></td>
81+
</tr>
82+
83+
<tr>
84+
<td colspan="2">--client-certificate string</td>
85+
</tr>
86+
<tr>
87+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to a client certificate file for TLS</p></td>
88+
</tr>
89+
90+
<tr>
91+
<td colspan="2">--client-key string</td>
92+
</tr>
93+
<tr>
94+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to a client key file for TLS</p></td>
95+
</tr>
96+
97+
<tr>
98+
<td colspan="2">--cloud-provider-gce-l7lb-src-cidrs cidrs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 130.211.0.0/22,35.191.0.0/16</td>
99+
</tr>
100+
<tr>
101+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>CIDRs opened in GCE firewall for L7 LB traffic proxy &amp; health checks</p></td>
102+
</tr>
103+
104+
<tr>
105+
<td colspan="2">--cloud-provider-gce-lb-src-cidrs cidrs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16</td>
106+
</tr>
107+
<tr>
108+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>CIDRs opened in GCE firewall for L4 LB traffic proxy &amp; health checks</p></td>
109+
</tr>
110+
111+
<tr>
112+
<td colspan="2">--cluster string</td>
113+
</tr>
114+
<tr>
115+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The name of the kubeconfig cluster to use</p></td>
116+
</tr>
117+
118+
<tr>
119+
<td colspan="2">--context string</td>
120+
</tr>
121+
<tr>
122+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The name of the kubeconfig context to use</p></td>
123+
</tr>
124+
125+
<tr>
126+
<td colspan="2">--default-not-ready-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 300</td>
127+
</tr>
128+
<tr>
129+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.</p></td>
130+
</tr>
131+
132+
<tr>
133+
<td colspan="2">--default-unreachable-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 300</td>
134+
</tr>
135+
<tr>
136+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.</p></td>
137+
</tr>
138+
139+
<tr>
140+
<td colspan="2">--disable-compression</td>
141+
</tr>
142+
<tr>
143+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, opt-out of response compression for all requests to the server</p></td>
144+
</tr>
145+
146+
<tr>
147+
<td colspan="2">-h, --help</td>
148+
</tr>
149+
<tr>
150+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>help for kubectl</p></td>
151+
</tr>
152+
153+
<tr>
154+
<td colspan="2">--insecure-skip-tls-verify</td>
155+
</tr>
156+
<tr>
157+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure</p></td>
158+
</tr>
159+
160+
<tr>
161+
<td colspan="2">--kubeconfig string</td>
162+
</tr>
163+
<tr>
164+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Path to the kubeconfig file to use for CLI requests.</p></td>
165+
</tr>
166+
167+
<tr>
168+
<td colspan="2">--match-server-version</td>
169+
</tr>
170+
<tr>
171+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Require server version to match client version</p></td>
172+
</tr>
173+
174+
<tr>
175+
<td colspan="2">-n, --namespace string</td>
176+
</tr>
177+
<tr>
178+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If present, the namespace scope for this CLI request</p></td>
179+
</tr>
180+
181+
<tr>
182+
<td colspan="2">--password string</td>
183+
</tr>
184+
<tr>
185+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Password for basic authentication to the API server</p></td>
186+
</tr>
187+
188+
<tr>
189+
<td colspan="2">--profile string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "none"</td>
190+
</tr>
191+
<tr>
192+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)</p></td>
193+
</tr>
194+
195+
<tr>
196+
<td colspan="2">--profile-output string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "profile.pprof"</td>
197+
</tr>
198+
<tr>
199+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Name of the file to write the profile to</p></td>
200+
</tr>
201+
202+
<tr>
203+
<td colspan="2">--request-timeout string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "0"</td>
204+
</tr>
205+
<tr>
206+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.</p></td>
207+
</tr>
208+
209+
<tr>
210+
<td colspan="2">-s, --server string</td>
211+
</tr>
212+
<tr>
213+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The address and port of the Kubernetes API server</p></td>
214+
</tr>
215+
216+
<tr>
217+
<td colspan="2">--tls-server-name string</td>
218+
</tr>
219+
<tr>
220+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used</p></td>
221+
</tr>
222+
223+
<tr>
224+
<td colspan="2">--token string</td>
225+
</tr>
226+
<tr>
227+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Bearer token for authentication to the API server</p></td>
228+
</tr>
229+
230+
<tr>
231+
<td colspan="2">--user string</td>
232+
</tr>
233+
<tr>
234+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The name of the kubeconfig user to use</p></td>
235+
</tr>
236+
237+
<tr>
238+
<td colspan="2">--username string</td>
239+
</tr>
240+
<tr>
241+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Username for basic authentication to the API server</p></td>
242+
</tr>
243+
244+
<tr>
245+
<td colspan="2">--version version[=true]</td>
246+
</tr>
247+
<tr>
248+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version</p></td>
249+
</tr>
250+
251+
<tr>
252+
<td colspan="2">--warnings-as-errors</td>
253+
</tr>
254+
<tr>
255+
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Treat warnings received from the server as errors and exit with a non-zero exit code</p></td>
256+
</tr>
257+
258+
</tbody>
259+
</table>
260+
261+
262+
263+
## {{% heading "seealso" %}}
264+
265+
* [kubectl annotate](kubectl_annotate/) - Update the annotations on a resource
266+
* [kubectl api-resources](kubectl_api-resources/) - Print the supported API resources on the server
267+
* [kubectl api-versions](kubectl_api-versions/) - Print the supported API versions on the server, in the form of "group/version"
268+
* [kubectl apply](kubectl_apply/) - Apply a configuration to a resource by file name or stdin
269+
* [kubectl attach](kubectl_attach/) - Attach to a running container
270+
* [kubectl auth](kubectl_auth/) - Inspect authorization
271+
* [kubectl autoscale](kubectl_autoscale/) - Auto-scale a deployment, replica set, stateful set, or replication controller
272+
* [kubectl certificate](kubectl_certificate/) - Modify certificate resources
273+
* [kubectl cluster-info](kubectl_cluster-info/) - Display cluster information
274+
* [kubectl completion](kubectl_completion/) - Output shell completion code for the specified shell (bash, zsh, fish, or powershell)
275+
* [kubectl config](kubectl_config/) - Modify kubeconfig files
276+
* [kubectl cordon](kubectl_cordon/) - Mark node as unschedulable
277+
* [kubectl cp](kubectl_cp/) - Copy files and directories to and from containers
278+
* [kubectl create](kubectl_create/) - Create a resource from a file or from stdin
279+
* [kubectl debug](kubectl_debug/) - Create debugging sessions for troubleshooting workloads and nodes
280+
* [kubectl delete](kubectl_delete/) - Delete resources by file names, stdin, resources and names, or by resources and label selector
281+
* [kubectl describe](kubectl_describe/) - Show details of a specific resource or group of resources
282+
* [kubectl diff](kubectl_diff/) - Diff the live version against a would-be applied version
283+
* [kubectl drain](kubectl_drain/) - Drain node in preparation for maintenance
284+
* [kubectl edit](kubectl_edit/) - Edit a resource on the server
285+
* [kubectl events](kubectl_events/) - List events
286+
* [kubectl exec](kubectl_exec/) - Execute a command in a container
287+
* [kubectl explain](kubectl_explain/) - Get documentation for a resource
288+
* [kubectl expose](kubectl_expose/) - Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
289+
* [kubectl get](kubectl_get/) - Display one or many resources
290+
* [kubectl kustomize](kubectl_kustomize/) - Build a kustomization target from a directory or URL
291+
* [kubectl label](kubectl_label/) - Update the labels on a resource
292+
* [kubectl logs](kubectl_logs/) - Print the logs for a container in a pod
293+
* [kubectl options](kubectl_options/) - Print the list of flags inherited by all commands
294+
* [kubectl patch](kubectl_patch/) - Update fields of a resource
295+
* [kubectl plugin](kubectl_plugin/) - Provides utilities for interacting with plugins
296+
* [kubectl port-forward](kubectl_port-forward/) - Forward one or more local ports to a pod
297+
* [kubectl proxy](kubectl_proxy/) - Run a proxy to the Kubernetes API server
298+
* [kubectl replace](kubectl_replace/) - Replace a resource by file name or stdin
299+
* [kubectl rollout](kubectl_rollout/) - Manage the rollout of a resource
300+
* [kubectl run](kubectl_run/) - Run a particular image on the cluster
301+
* [kubectl scale](kubectl_scale/) - Set a new size for a deployment, replica set, or replication controller
302+
* [kubectl set](kubectl_set/) - Set specific features on objects
303+
* [kubectl taint](kubectl_taint/) - Update the taints on one or more nodes
304+
* [kubectl top](kubectl_top/) - Display resource (CPU/memory) usage
305+
* [kubectl uncordon](kubectl_uncordon/) - Mark node as schedulable
306+
* [kubectl version](kubectl_version/) - Print the client and server version information
307+
* [kubectl wait](kubectl_wait/) - Experimental: Wait for a specific condition on one or many resources
308+

0 commit comments

Comments
 (0)