kubernetes reference name reference weight 20 title Command line tool kubectl card contenttype reference title kubectl command line tool nolist true weight 110

Answer:
---
title: Command line tool (kubectl)
content_type: reference
weight: 110
no_list: true
card:
  name: reference
  title: kubectl command line tool
  weight: 20
---

This tool is named `kubectl`.

For configuration, `kubectl` looks for a file named `config` in the `$HOME/.kube` directory.
You can specify other [kubeconfig](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
files by setting the `KUBECONFIG` environment variable or by setting the
[`--kubeconfig`](/docs/concepts/configuration/organize-cluster-access-kubeconfig/) flag.

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

For installation instructions, see [Installing kubectl](/docs/tasks/tools/#kubectl);
for a quick guide, see the [cheat sheet](/docs/reference/kubectl/quick-reference/).
If you're used to using the `docker` command-line tool,
[`kubectl` for Docker Users](/docs/reference/kubectl/docker-cli-to-kubectl/) explains some equivalent commands for Kubernetes.

## Syntax

Use the following syntax to run `kubectl` commands from your terminal window:

```shell
kubectl [command] [TYPE] [NAME] [flags]
```

where `command`, `TYPE`, `NAME`, and `flags` are:

* `command`: Specifies the operation that you want to perform on one or more resources,
  for example `create`, `get`, `describe`, `delete`.

* `TYPE`: Specifies the [resource type](#resource-types). Resource types are case-insensitive and
  you can specify the singular, plural, or abbreviated forms.
  For example, the following commands produce the same output:

  ```shell
  kubectl get pod pod1
  kubectl get pods pod1
  kubectl get po pod1
  ```

* `NAME`: Specifies the name of the resource. Names are case-sensitive. If the name is omitted,
  details for all resources are displayed, for example `kubectl get pods`.

  When performing an operation on multiple resources, you can specify each resource by
  type and name or specify one or more files:

  * To specify resources by type and name:

    * To group resources if they are all the same type:  `TYPE1 name1 name2 name<#>`.

      Example: `kubectl get pod example-pod1 example-pod2`

    * To specify multiple resource types individually:  `TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>`.

      Example: `kubectl get pod/example-pod1 replicationcontroller/example-rc1`

  * To specify resources with one or more files:  `-f file1 -f file2 -f file<#>`

    * [Use YAML rather than JSON](/docs/concepts/configuration/overview/#general-configuration-tips)
      since YAML tends to be more user-friendly, especially for configuration files.

      Example: `kubectl get -f ./pod.yaml`

* `flags`: Specifies optional flags. For example, you can use the `-s` or `--server` flags
  to specify the address and port of the Kubernetes API server.

Flags that you specify from the command line override default values and any corresponding environment variables.

If you need help, run `kubectl help` from the terminal window.

## In-cluster authentication and namespace overrides

By default `kubectl` will first determine if it is running within a pod, and thus in a cluster.
It starts by checking for the `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT` environment
variables and the existence of a service account token file at `/var/run/secrets/kubernetes.io/serviceaccount/token`.
If all three are found in-cluster authentication is assumed.

To maintain backwards compatibility, if the `POD_NAMESPACE` environment variable is set
during in-cluster authentication it will override the default namespace from the
service account token. Any manifests or tools relying on namespace defaulting will be affected by this.

**`POD_NAMESPACE` environment variable**

If the `POD_NAMESPACE` environment variable is set, cli operations on namespaced resources
will default to the variable value. For example, if the variable is set to `seattle`,
`kubectl get pods` would return pods in the `seattle` namespace. This is because pods are
a namespaced resource, and no namespace was provided in the command. Review the output
of `kubectl api-resources` to determine if a resource is namespaced.

Explicit use of `--namespace <value>` overrides this behavior.

**How kubectl handles ServiceAccount tokens**

If:

* there is Kubernetes service account token file mounted at
  `/var/run/secrets/kubernetes.io/serviceaccount/token`, and
* the `KUBERNETES_SERVICE_HOST` environment variable is set, and
* the `KUBERNETES_SERVICE_PORT` environment variable is set, and
* you don't explicitly specify a namespace on the kubectl command line

then kubectl assumes it is running in your cluster. The kubectl tool looks up the
namespace of that ServiceAccount (this is the same as the namespace of the Pod)
and acts against that namespace. This is different from what happens outside of a
cluster; when kubectl runs outside a cluster and you don't specify a namespace,
the kubectl command acts against the namespace set for the current context in your
client configuration. To change the default namespace for your kubectl you can use the
following command:

```shell
kubectl config set-context --current --namespace=<namespace-name>
```

## Operations

The following table includes short descriptions and the general syntax for all of the `kubectl` operations:

Operation       | Syntax    |       Description
-------------------- | -------------------- | --------------------
`alpha`    | `kubectl alpha SUBCOMMAND [flags]` | List the available commands that correspond to alpha features, which are not enabled in Kubernetes clusters by default.
`annotate`    | kubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags] | Add or update the annotations of one or more resources.
`api-resources`    | `kubectl api-resources [flags]` | List the API resources that are available.
`api-versions`    | `kubectl api-versions [flags]` | List the API versions that are available.
`apply`            | `kubectl apply -f FILENAME [flags]`| Apply a configuration change to a resource from a file or stdin.
`attach`        | `kubectl attach POD -c CONTAINER [-i] [-t] [flags]` | Attach to a running container either to view the output stream or interact with the container (stdin).
`auth`    | `kubectl auth [flags] [options]` | Inspect authorization.
`autoscale`    | kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags] | Automatically scale the set of pods that are managed by a replication controller.
`certificate`    | `kubectl certificate SUBCOMMAND [options]` | Modify certificate resources.
`cluster-info`    | `kubectl cluster-info [flags]` | Display endpoint information about the master and services in the cluster.
`completion`    | `kubectl completion SHELL [options]` | Output shell completion code for the specified shell (bash or zsh).
`config`        | `kubectl config SUBCOMMAND [flags]` | Modifies kubeconfig files. See the individual subcommands for details.
`convert`    | `kubectl convert -f FILENAME [options]` | Convert config files between different API versions. Both YAML and JSON formats are accepted. Note - requires `kubectl-convert` plugin to be installed.
`cordon`    | `kubectl cordon NODE [options]` | Mark node as unschedulable.
`cp`    | `kubectl cp <file-spec-src> <file-spec-dest> [options]` | Copy files and directories to and from containers.
`create`        | `kubectl create -f FILENAME [flags]` | Create one or more resources from a file or stdin.
`delete`        | kubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags] | Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.
`describe`    | kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags] | Display the detailed state of one or more resources.
`diff`        | `kubectl diff -f FILENAME [flags]`| Diff file or stdin against live configuration.
`drain`    | `kubectl drain NODE [options]` | Drain node in preparation for maintenance.
`edit`        | kubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags] | Edit and update the definition of one or more resources on the server by using the default editor.
`events`      | `kubectl events` | List events
`exec`        | `kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]` | Execute a command against a container in a pod.
`explain`    | `kubectl explain TYPE [--recursive=false] [flags]` | Get documentation of various resources. For instance pods, nodes, services, etc.
`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] | Expose a replication controller, service, or pod as a new Kubernetes service.
`get`        | kubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags] | List one or more resources.
`kustomize`    | `kubectl kustomize <dir> [flags] [options]` | List a set of API resources generated from instructions in a kustomization.yaml file. The argument must be the path to the directory containing the file, or a git repository URL with a path suffix specifying same with respect to the repository root.
`label`        | kubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags] | Add or update the labels of one or more resources.
`logs`        | `kubectl logs POD [-c CONTAINER] [--follow] [flags]` | Print the logs for a container in a pod.
`options`    | `kubectl options` | List of global command-line options, which apply to all commands.
`patch`        | kubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags] | Update one or more fields of a resource by using the strategic merge patch process.
`plugin`    | `kubectl plugin [flags] [options]` | Provides utilities for interacting with plugins.
`port-forward`    | `kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]` | Forward one or more local ports to a pod.
`proxy`        | `kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]` | Run a proxy to the Kubernetes API server.
`replace`        | `kubectl replace -f FILENAME` | Replace a resource from a file or stdin.
`rollout`    | `kubectl rollout SUBCOMMAND [options]` | Manage the rollout of a resource. Valid resource types include: deployments, daemonsets and statefulsets.
`run`        | kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client|none] [--overrides=inline-json] [flags] | Run a specified image on the cluster.
`scale`        | kubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags] | Update the size of the specified replication controller.
`set`    | `kubectl set SUBCOMMAND [options]` | Configure application resources.
`taint`    | `kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]` | Update the taints on one or more nodes.
`top`    | kubectl top (POD | NODE) [flags] [options] | Display Resource (CPU/Memory/Storage) usage of pod or node.
`uncordon`    | `kubectl uncordon NODE [options]` | Mark node as schedulable.
`version`        | `kubectl version [--client] [flags]` | Display the Kubernetes version running on the client and server.
`wait`    | kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available] [options] | Experimental: Wait for a specific condition on one or many resources.

To learn more about command operations, see the [kubectl](/docs/reference/kubectl/kubectl/) reference documentation.

## Resource types

The following table includes a list of all the supported resource types and their abbreviated aliases.

(This output can be retrieved from `kubectl api-resources`, and was accurate as of Kubernetes 1.25.0)

| NAME | SHORTNAMES | APIVERSION | NAMESPACED | KIND |
|---|---|---|---|---|
| `bindings` |  | v1 | true | Binding |
| `componentstatuses` | `cs` | v1 | false | ComponentStatus |
| `configmaps` | `cm` | v1 | true | ConfigMap |
| `endpoints` | `ep` | v1 | true | Endpoints |
| `events` | `ev` | v1 | true | Event |
| `limitranges` | `limits` | v1 | true | LimitRange |
| `namespaces` | `ns` | v1 | false | Namespace |
| `nodes` | `no` | v1 | false | Node |
| `persistentvolumeclaims` | `pvc` | v1 | true | PersistentVolumeClaim |
| `persistentvolumes` | `pv` | v1 | false | PersistentVolume |
| `pods` | `po` | v1 | true | Pod |
| `podtemplates` |  | v1 | true | PodTemplate |
| `replicationcontrollers` | `rc` | v1 | true | ReplicationController |
| `resourcequotas` | `quota` | v1 | true | ResourceQuota |
| `secrets` |  | v1 | true | Secret |
| `serviceaccounts` | `sa` | v1 | true | ServiceAccount |
| `services` | `svc` | v1 | true | Service |
| `mutatingwebhookconfigurations` |  | admissionregistration.k8s.io/v1 | false | MutatingWebhookConfiguration |
| `validatingwebhookconfigurations` |  | admissionregistration.k8s.io/v1 | false | ValidatingWebhookConfiguration |
| `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 | Deployment |
| `replicasets` | `rs` | apps/v1 | true | ReplicaSet |
| `statefulsets` | `sts` | apps/v1 | true | StatefulSet |
| `tokenreviews` |  | authentication.k8s.io/v1 | false | TokenReview |
| `localsubjectaccessreviews` |  | authorization.k8s.io/v1 | true | LocalSubjectAccessReview |
| `selfsubjectaccessreviews` |  | authorization.k8s.io/v1 | false | SelfSubjectAccessReview |
| `selfsubjectrulesreviews` |  | authorization.k8s.io/v1 | false | SelfSubjectRulesReview |
| `subjectaccessreviews` |  | authorization.k8s.io/v1 | false | SubjectAccessReview |
| `horizontalpodautoscalers` | `hpa` | autoscaling/v2 | true | HorizontalPodAutoscaler |
| `cronjobs` | `cj` | batch/v1 | true | CronJob |
| `jobs` |  | batch/v1 | true | Job |
| `certificatesigningrequests` | `csr` | certificates.k8s.io/v1 | false | CertificateSigningRequest |
| `leases` |  | coordination.k8s.io/v1 | true | Lease |
| `endpointslices` |  | discovery.k8s.io/v1 | true | EndpointSlice |
| `events` | `ev` | events.k8s.io/v1 | true | Event |
| `flowschemas` |  | flowcontrol.apiserver.k8s.io/v1beta2 | false | FlowSchema |
| `prioritylevelconfigurations` |  | flowcontrol.apiserver.k8s.io/v1beta2 | false | PriorityLevelConfiguration |
| `ingressclasses` |  | networking.k8s.io/v1 | false | IngressClass |
| `ingresses` | `ing` | networking.k8s.io/v1 | true | Ingress |
| `networkpolicies` | `netpol` | networking.k8s.io/v1 | true | NetworkPolicy |
| `runtimeclasses` |  | node.k8s.io/v1 | false | RuntimeClass |
| `poddisruptionbudgets` | `pdb` | policy/v1 | true | PodDisruptionBudget |
| `podsecuritypolicies` | `psp` | policy/v1beta1 | false | PodSecurityPolicy |
| `clusterrolebindings` |  | rbac.authorization.k8s.io/v1 | false | ClusterRoleBinding |
| `clusterroles` |  | rbac.authorization.k8s.io/v1 | false | ClusterRole |
| `rolebindings` |  | rbac.authorization.k8s.io/v1 | true | RoleBinding |
| `roles` |  | rbac.authorization.k8s.io/v1 | true | Role |
| `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 | VolumeAttachment |

## Output options

Use the following sections for information about how you can format or sort the output
of certain commands. For details about which commands support the various output options,
see the [kubectl](/docs/reference/kubectl/kubectl/) reference documentation.

### Formatting output

The default output format for all `kubectl` commands is the human readable plain-text format.
To output details to your terminal window in a specific format, you can add either the `-o`
or `--output` flags to a supported `kubectl` command.

#### Syntax

```shell
kubectl [command] [TYPE] [NAME] -o <output_format>
```

Depending on the `kubectl` operation, the following output formats are supported:

Output format | Description
--------------| -----------
`-o custom-columns=<spec>` | Print a table using a comma separated list of [custom columns](#custom-columns).
`-o custom-columns-file=<filename>` | Print a table using the [custom columns](#custom-columns) template in the `<filename>` file.
`-o json`     | Output a JSON formatted API object.
`-o jsonpath=<template>` | Print the fields defined in a [jsonpath](/docs/reference/kubectl/jsonpath/) expression.
`-o jsonpath-file=<filename>` | Print the fields defined by the [jsonpath](/docs/reference/kubectl/jsonpath/) expression in the `<filename>` file.
`-o name`     | Print only the resource name and nothing else.
`-o wide`     | Output in the plain-text format with any additional information. For pods, the node name is included.
`-o yaml`     | Output a YAML formatted API object.

##### Example

In this example, the following command outputs the details for a single pod as a YAML formatted object:

```shell
kubectl get pod web-pod-13je7 -o yaml
```

Remember: See the [kubectl](/docs/reference/kubectl/kubectl/) reference documentation
for details about which output format is supported by each command.

#### Custom columns

To define custom columns and output only the details that you want into a table, you can use the `custom-columns` option.
You can choose to define the custom columns inline or use a template file: `-o custom-columns=<spec>` or `-o custom-columns-file=<filename>`.

##### Examples

Inline:

```shell
kubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion
```

Template file:

```shell
kubectl get pods <pod-name> -o custom-columns-file=template.txt
```

where the `template.txt` file contains:

```
NAME          RSRC
metadata.name metadata.resourceVersion
```
The result of running either command is similar to:

```
NAME           RSRC
submit-queue   610995
```

#### Server-side columns

`kubectl` supports receiving specific column information from the server about objects.
This means that for any given resource, the server will return columns and rows relevant to that resource, for the client to print.
This allows for consistent human-readable output across clients used against the same cluster, by having the server encapsulate the details of printing.

This feature is enabled by default. To disable it, add the
`--server-print=false` flag to the `kubectl get` command.

##### Examples

To print information about the status of a pod, use a command like the following:

```shell
kubectl get pods <pod-name> --server-print=false
```

The output is similar to:

```
NAME       AGE
pod-name   1m
```

### Sorting list objects

To output objects to a sorted list in your terminal window, you can add the `--sort-by` flag
to a supported `kubectl` command. Sort your objects by specifying any numeric or string field
with the `--sort-by` flag. To specify a field, use a [jsonpath](/docs/reference/kubectl/jsonpath/) expression.

#### Syntax

```shell
kubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>
```

##### Example

To print a list of pods sorted by name, you run:

```shell
kubectl get pods --sort-by=.metadata.name
```

## Examples: Common operations

Use the following set of examples to help you familiarize yourself with running the commonly used `kubectl` operations:

`kubectl apply` - Apply or Update a resource from a file or stdin.

```shell
# 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 one or more resources.

```shell
# 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 detailed state of one or more resources, including the uninitialized ones by default.

```shell
# 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
```

The `kubectl get` command is usually used for retrieving one or more
resources of the same resource type. It features a rich set of flags that allows
you to customize the output format using the `-o` or `--output` flag, for example.
You can specify the `-w` or `--watch` flag to start watching updates to a particular
object. The `kubectl describe` command is more focused on describing the many
related aspects of a specified resource. It may invoke several API calls to the
API server to build a view for the user. For example, the `kubectl describe node`
command retrieves not only the information about the node, but also a summary of
the pods running on it, the events generated for the node etc.

`kubectl delete` - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.

```shell
# 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` - Execute a command against a container in a pod.

```shell
# 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` - Print the logs for a container in a pod.

```shell
# 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` - View a diff of the proposed updates to a cluster.

```shell
# Diff resources included in "pod.json".
kubectl diff -f pod.json

# Diff file read from stdin.
cat service.yaml | kubectl diff -f -
```

## Examples: Creating and using plugins

Use the following set of examples to help you familiarize yourself with writing and using `kubectl` plugins:

```shell
# create a simple plugin in any language and name the resulting executable file
# so that it begins with the prefix "kubectl-"
cat ./kubectl-hello
```
```shell
#!/bin/sh

# this plugin prints the words "hello world"
echo "hello world"
```
With a plugin written, let's make it executable:
```bash
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
```

```shell
# 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
```

In order to view all of the plugins that are available to `kubectl`, use
the `kubectl plugin list` subcommand:

```shell
kubectl plugin list
```
The output is similar to:
```
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` also warns you about plugins that are not
executable, or that are shadowed by other plugins; for example:

```shell
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
```

You can think of plugins as a means to build more complex functionality on top
of the existing kubectl commands:

```shell
cat ./kubectl-whoami
```

The next few examples assume that you already made `kubectl-whoami` have
the following contents:

```shell
#!/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='Current user: '
```

Running the above command gives you an output containing the user for the
current context in your KUBECONFIG file:

```shell
# 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
```

##

* Read the `kubectl` reference documentation:
  * the kubectl [command reference](/docs/reference/kubectl/kubectl/)
  * the [command line arguments](/docs/reference/kubectl/generated/kubectl/) reference
* Learn about [`kubectl` usage conventions](/docs/reference/kubectl/conventions/)
* Read about [JSONPath support](/docs/reference/kubectl/jsonpath/) in kubectl
* Read about how to [extend kubectl with plugins](/docs/tasks/extend-kubectl/kubectl-plugins)
  * To find out more about plugins, take a look at the [example CLI plugin](https://github.com/kubernetes/sample-cli-plugin).

title  Command line tool  kubectl  content type  reference weight  110 no list  true card    name  reference   title  kubectl command line tool   weight  20           overview       This tool is named  kubectl    For configuration   kubectl  looks for a file named  config  in the   HOME  kube  directory  You can specify other  kubeconfig   docs concepts configuration organize cluster access kubeconfig   files by setting the  KUBECONFIG  environment variable or by setting the     kubeconfig    docs concepts configuration organize cluster access kubeconfig   flag   This overview covers  kubectl  syntax  describes the command operations  and provides common examples  For details about each command  including all the supported flags and subcommands  see the  kubectl   docs reference kubectl generated kubectl   reference documentation   For installation instructions  see  Installing kubectl   docs tasks tools  kubectl   for a quick guide  see the  cheat sheet   docs reference kubectl quick reference    If you re used to using the  docker  command line tool    kubectl  for Docker Users   docs reference kubectl docker cli to kubectl   explains some equivalent commands for Kubernetes        body         Syntax  Use the following syntax to run  kubectl  commands from your terminal window      shell kubectl  command   TYPE   NAME   flags       where  command    TYPE    NAME   and  flags  are      command   Specifies the operation that you want to perform on one or more resources    for example  create    get    describe    delete       TYPE   Specifies the  resource type   resource types   Resource types are case insensitive and   you can specify the singular  plural  or abbreviated forms    For example  the following commands produce the same output        shell   kubectl get pod pod1   kubectl get pods pod1   kubectl get po pod1           NAME   Specifies the name of the resource  Names are case sensitive  If the name is omitted    details for all resources are displayed  for example  kubectl get pods      When performing an operation on multiple resources  you can specify each resource by   type and name or specify one or more files       To specify resources by type and name         To group resources if they are all the same type    TYPE1 name1 name2 name      br         Example   kubectl get pod example pod1 example pod2         To specify multiple resource types individually    TYPE1 name1 TYPE1 name2 TYPE2 name3 TYPE    name      br         Example   kubectl get pod example pod1 replicationcontroller example rc1       To specify resources with one or more files     f file1  f file2  f file             Use YAML rather than JSON   docs concepts configuration overview  general configuration tips        since YAML tends to be more user friendly  especially for configuration files  br         Example   kubectl get  f   pod yaml      flags   Specifies optional flags  For example  you can use the   s  or    server  flags   to specify the address and port of the Kubernetes API server  br     Flags that you specify from the command line override default values and any corresponding environment variables    If you need help  run  kubectl help  from the terminal window      In cluster authentication and namespace overrides  By default  kubectl  will first determine if it is running within a pod  and thus in a cluster  It starts by checking for the  KUBERNETES SERVICE HOST  and  KUBERNETES SERVICE PORT  environment variables and the existence of a service account token file at   var run secrets kubernetes io serviceaccount token   If all three are found in cluster authentication is assumed   To maintain backwards compatibility  if the  POD NAMESPACE  environment variable is set during in cluster authentication it will override the default namespace from the service account token  Any manifests or tools relying on namespace defaulting will be affected by this      POD NAMESPACE  environment variable    If the  POD NAMESPACE  environment variable is set  cli operations on namespaced resources will default to the variable value  For example  if the variable is set to  seattle    kubectl get pods  would return pods in the  seattle  namespace  This is because pods are a namespaced resource  and no namespace was provided in the command  Review the output of  kubectl api resources  to determine if a resource is namespaced   Explicit use of    namespace  value   overrides this behavior     How kubectl handles ServiceAccount tokens    If     there is Kubernetes service account token file mounted at     var run secrets kubernetes io serviceaccount token   and   the  KUBERNETES SERVICE HOST  environment variable is set  and   the  KUBERNETES SERVICE PORT  environment variable is set  and   you don t explicitly specify a namespace on the kubectl command line  then kubectl assumes it is running in your cluster  The kubectl tool looks up the namespace of that ServiceAccount  this is the same as the namespace of the Pod  and acts against that namespace  This is different from what happens outside of a cluster  when kubectl runs outside a cluster and you don t specify a namespace  the kubectl command acts against the namespace set for the current context in your client configuration  To change the default namespace for your kubectl you can use the following command      shell kubectl config set context   current   namespace  namespace name          Operations  The following table includes short descriptions and the general syntax for all of the  kubectl  operations   Operation         Syntax            Description                                                                     alpha        kubectl alpha SUBCOMMAND  flags     List the available commands that correspond to alpha features  which are not enabled in Kubernetes clusters by default   annotate        code kubectl annotate   f FILENAME   124  TYPE NAME   124  TYPE NAME  KEY 1 VAL 1     KEY N VAL N    overwrite     all     resource version version   flags   code    Add or update the annotations of one or more resources   api resources        kubectl api resources  flags     List the API resources that are available   api versions        kubectl api versions  flags     List the API versions that are available   apply                kubectl apply  f FILENAME  flags    Apply a configuration change to a resource from a file or stdin   attach            kubectl attach POD  c CONTAINER   i    t   flags     Attach to a running container either to view the output stream or interact with the container  stdin    auth        kubectl auth  flags   options     Inspect authorization   autoscale        code kubectl autoscale   f FILENAME   124  TYPE NAME   124  TYPE NAME     min MINPODS    max MAXPODS    cpu percent CPU   flags   code    Automatically scale the set of pods that are managed by a replication controller   certificate        kubectl certificate SUBCOMMAND  options     Modify certificate resources   cluster info        kubectl cluster info  flags     Display endpoint information about the master and services in the cluster   completion        kubectl completion SHELL  options     Output shell completion code for the specified shell  bash or zsh    config            kubectl config SUBCOMMAND  flags     Modifies kubeconfig files  See the individual subcommands for details   convert        kubectl convert  f FILENAME  options     Convert config files between different API versions  Both YAML and JSON formats are accepted  Note   requires  kubectl convert  plugin to be installed   cordon        kubectl cordon NODE  options     Mark node as unschedulable   cp        kubectl cp  file spec src   file spec dest   options     Copy files and directories to and from containers   create            kubectl create  f FILENAME  flags     Create one or more resources from a file or stdin   delete            code kubectl delete   f FILENAME   124  TYPE  NAME   124   NAME   124   l label   124    all    flags   code    Delete resources either from a file  stdin  or specifying label selectors  names  resource selectors  or resources   describe        code kubectl describe   f FILENAME   124  TYPE  NAME PREFIX   124   NAME   124   l label    flags   code    Display the detailed state of one or more resources   diff            kubectl diff  f FILENAME  flags    Diff file or stdin against live configuration   drain        kubectl drain NODE  options     Drain node in preparation for maintenance   edit            code kubectl edit   f FILENAME   124  TYPE NAME   124  TYPE NAME   flags   code    Edit and update the definition of one or more resources on the server by using the default editor   events          kubectl events    List events  exec            kubectl exec POD   c CONTAINER    i    t   flags      COMMAND  args         Execute a command against a container in a pod   explain        kubectl explain TYPE    recursive false   flags     Get documentation of various resources  For instance pods  nodes  services  etc   expose            code kubectl expose   f FILENAME   124  TYPE NAME   124  TYPE NAME     port port     protocol TCP  124 UDP     target port number or name     name name     external ip external ip of service     type type   flags   code    Expose a replication controller  service  or pod as a new Kubernetes service   get            code kubectl get   f FILENAME   124  TYPE  NAME   124   NAME   124   l label      watch     sort by FIELD     o   124    output  OUTPUT FORMAT   flags   code    List one or more resources   kustomize        kubectl kustomize  dir   flags   options     List a set of API resources generated from instructions in a kustomization yaml file  The argument must be the path to the directory containing the file  or a git repository URL with a path suffix specifying same with respect to the repository root   label            code kubectl label   f FILENAME   124  TYPE NAME   124  TYPE NAME  KEY 1 VAL 1     KEY N VAL N    overwrite     all     resource version version   flags   code    Add or update the labels of one or more resources   logs            kubectl logs POD   c CONTAINER     follow   flags     Print the logs for a container in a pod   options        kubectl options    List of global command line options  which apply to all commands   patch            code kubectl patch   f FILENAME   124  TYPE NAME   124  TYPE NAME    patch PATCH  flags   code    Update one or more fields of a resource by using the strategic merge patch process   plugin        kubectl plugin  flags   options     Provides utilities for interacting with plugins   port forward        kubectl port forward POD  LOCAL PORT  REMOTE PORT      LOCAL PORT N  REMOTE PORT N   flags     Forward one or more local ports to a pod   proxy            kubectl proxy    port PORT     www static dir     www prefix prefix     api prefix prefix   flags     Run a proxy to the Kubernetes API server   replace            kubectl replace  f FILENAME    Replace a resource from a file or stdin   rollout        kubectl rollout SUBCOMMAND  options     Manage the rollout of a resource  Valid resource types include  deployments  daemonsets and statefulsets   run            code kubectl run NAME   image image    env  key value      port port     dry run server  124 client  124 none     overrides inline json   flags   code    Run a specified image on the cluster   scale            code kubectl scale   f FILENAME   124  TYPE NAME   124  TYPE NAME    replicas COUNT    resource version version     current replicas count   flags   code    Update the size of the specified replication controller   set        kubectl set SUBCOMMAND  options     Configure application resources   taint        kubectl taint NODE NAME KEY 1 VAL 1 TAINT EFFECT 1     KEY N VAL N TAINT EFFECT N  options     Update the taints on one or more nodes   top        code kubectl top  POD   124  NODE   flags   options   code    Display Resource  CPU Memory Storage  usage of pod or node   uncordon        kubectl uncordon NODE  options     Mark node as schedulable   version            kubectl version    client   flags     Display the Kubernetes version running on the client and server   wait        code kubectl wait    f FILENAME    124  resource group resource name   124  resource group    l label   124    all       for delete  124   for condition available   options   code    Experimental  Wait for a specific condition on one or many resources   To learn more about command operations  see the  kubectl   docs reference kubectl kubectl   reference documentation      Resource types  The following table includes a list of all the supported resource types and their abbreviated aliases    This output can be retrieved from  kubectl api resources   and was accurate as of Kubernetes 1 25 0     NAME   SHORTNAMES   APIVERSION   NAMESPACED   KIND                            bindings       v1   true   Binding      componentstatuses     cs    v1   false   ComponentStatus      configmaps     cm    v1   true   ConfigMap      endpoints     ep    v1   true   Endpoints      events     ev    v1   true   Event      limitranges     limits    v1   true   LimitRange      namespaces     ns    v1   false   Namespace      nodes     no    v1   false   Node      persistentvolumeclaims     pvc    v1   true   PersistentVolumeClaim      persistentvolumes     pv    v1   false   PersistentVolume      pods     po    v1   true   Pod      podtemplates       v1   true   PodTemplate      replicationcontrollers     rc    v1   true   ReplicationController      resourcequotas     quota    v1   true   ResourceQuota      secrets       v1   true   Secret      serviceaccounts     sa    v1   true   ServiceAccount      services     svc    v1   true   Service      mutatingwebhookconfigurations       admissionregistration k8s io v1   false   MutatingWebhookConfiguration      validatingwebhookconfigurations       admissionregistration k8s io v1   false   ValidatingWebhookConfiguration      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   Deployment      replicasets     rs    apps v1   true   ReplicaSet      statefulsets     sts    apps v1   true   StatefulSet      tokenreviews       authentication k8s io v1   false   TokenReview      localsubjectaccessreviews       authorization k8s io v1   true   LocalSubjectAccessReview      selfsubjectaccessreviews       authorization k8s io v1   false   SelfSubjectAccessReview      selfsubjectrulesreviews       authorization k8s io v1   false   SelfSubjectRulesReview      subjectaccessreviews       authorization k8s io v1   false   SubjectAccessReview      horizontalpodautoscalers     hpa    autoscaling v2   true   HorizontalPodAutoscaler      cronjobs     cj    batch v1   true   CronJob      jobs       batch v1   true   Job      certificatesigningrequests     csr    certificates k8s io v1   false   CertificateSigningRequest      leases       coordination k8s io v1   true   Lease      endpointslices       discovery k8s io v1   true   EndpointSlice      events     ev    events k8s io v1   true   Event      flowschemas       flowcontrol apiserver k8s io v1beta2   false   FlowSchema      prioritylevelconfigurations       flowcontrol apiserver k8s io v1beta2   false   PriorityLevelConfiguration      ingressclasses       networking k8s io v1   false   IngressClass      ingresses     ing    networking k8s io v1   true   Ingress      networkpolicies     netpol    networking k8s io v1   true   NetworkPolicy      runtimeclasses       node k8s io v1   false   RuntimeClass      poddisruptionbudgets     pdb    policy v1   true   PodDisruptionBudget      podsecuritypolicies     psp    policy v1beta1   false   PodSecurityPolicy      clusterrolebindings       rbac authorization k8s io v1   false   ClusterRoleBinding      clusterroles       rbac authorization k8s io v1   false   ClusterRole      rolebindings       rbac authorization k8s io v1   true   RoleBinding      roles       rbac authorization k8s io v1   true   Role      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   VolumeAttachment       Output options  Use the following sections for information about how you can format or sort the output of certain commands  For details about which commands support the various output options  see the  kubectl   docs reference kubectl kubectl   reference documentation       Formatting output  The default output format for all  kubectl  commands is the human readable plain text format  To output details to your terminal window in a specific format  you can add either the   o  or    output  flags to a supported  kubectl  command        Syntax     shell kubectl  command   TYPE   NAME   o  output format       Depending on the  kubectl  operation  the following output formats are supported   Output format   Description                               o custom columns  spec     Print a table using a comma separated list of  custom columns   custom columns     o custom columns file  filename     Print a table using the  custom columns   custom columns  template in the   filename   file    o json        Output a JSON formatted API object    o jsonpath  template     Print the fields defined in a  jsonpath   docs reference kubectl jsonpath   expression    o jsonpath file  filename     Print the fields defined by the  jsonpath   docs reference kubectl jsonpath   expression in the   filename   file    o name        Print only the resource name and nothing else    o wide        Output in the plain text format with any additional information  For pods  the node name is included    o yaml        Output a YAML formatted API object         Example  In this example  the following command outputs the details for a single pod as a YAML formatted object      shell kubectl get pod web pod 13je7  o yaml      Remember  See the  kubectl   docs reference kubectl kubectl   reference documentation for details about which output format is supported by each command        Custom columns  To define custom columns and output only the details that you want into a table  you can use the  custom columns  option  You can choose to define the custom columns inline or use a template file    o custom columns  spec   or   o custom columns file  filename           Examples  Inline      shell kubectl get pods  pod name   o custom columns NAME  metadata name RSRC  metadata resourceVersion      Template file      shell kubectl get pods  pod name   o custom columns file template txt      where the  template txt  file contains       NAME          RSRC metadata name metadata resourceVersion     The result of running either command is similar to       NAME           RSRC submit queue   610995           Server side columns   kubectl  supports receiving specific column information from the server about objects  This means that for any given resource  the server will return columns and rows relevant to that resource  for the client to print  This allows for consistent human readable output across clients used against the same cluster  by having the server encapsulate the details of printing   This feature is enabled by default  To disable it  add the    server print false  flag to the  kubectl get  command         Examples  To print information about the status of a pod  use a command like the following      shell kubectl get pods  pod name    server print false      The output is similar to       NAME       AGE pod name   1m          Sorting list objects  To output objects to a sorted list in your terminal window  you can add the    sort by  flag to a supported  kubectl  command  Sort your objects by specifying any numeric or string field with the    sort by  flag  To specify a field  use a  jsonpath   docs reference kubectl jsonpath   expression        Syntax     shell kubectl  command   TYPE   NAME    sort by  jsonpath exp             Example  To print a list of pods sorted by name  you run      shell kubectl get pods   sort by  metadata name         Examples  Common operations  Use the following set of examples to help you familiarize yourself with running the commonly used  kubectl  operations    kubectl apply    Apply or Update a resource from a file or stdin      shell   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 one or more resources      shell   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 detailed state of one or more resources  including the uninitialized ones by default      shell   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       The  kubectl get  command is usually used for retrieving one or more resources of the same resource type  It features a rich set of flags that allows you to customize the output format using the   o  or    output  flag  for example  You can specify the   w  or    watch  flag to start watching updates to a particular object  The  kubectl describe  command is more focused on describing the many related aspects of a specified resource  It may invoke several API calls to the API server to build a view for the user  For example  the  kubectl describe node  command retrieves not only the information about the node  but also a summary of the pods running on it  the events generated for the node etc     kubectl delete    Delete resources either from a file  stdin  or specifying label selectors  names  resource selectors  or resources      shell   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    Execute a command against a container in a pod      shell   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    Print the logs for a container in a pod      shell   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    View a diff of the proposed updates to a cluster      shell   Diff resources included in  pod json   kubectl diff  f pod json    Diff file read from stdin  cat service yaml   kubectl diff  f           Examples  Creating and using plugins  Use the following set of examples to help you familiarize yourself with writing and using  kubectl  plugins      shell   create a simple plugin in any language and name the resulting executable file   so that it begins with the prefix  kubectl   cat   kubectl hello        shell    bin sh    this plugin prints the words  hello world  echo  hello world      With a plugin written  let s make it executable     bash 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         shell   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      In order to view all of the plugins that are available to  kubectl   use the  kubectl plugin list  subcommand      shell kubectl plugin list     The output is similar to      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  also warns you about plugins that are not executable  or that are shadowed by other plugins  for example      shell 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      You can think of plugins as a means to build more complex functionality on top of the existing kubectl commands      shell cat   kubectl whoami      The next few examples assume that you already made  kubectl whoami  have the following contents      shell    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  Current user         Running the above command gives you an output containing the user for the current context in your KUBECONFIG file      shell   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             Read the  kubectl  reference documentation      the kubectl  command reference   docs reference kubectl kubectl       the  command line arguments   docs reference kubectl generated kubectl   reference   Learn about   kubectl  usage conventions   docs reference kubectl conventions     Read about  JSONPath support   docs reference kubectl jsonpath   in kubectl   Read about how to  extend kubectl with plugins   docs tasks extend kubectl kubectl plugins      To find out more about plugins  take a look at the  example CLI plugin  https   github com kubernetes sample cli plugin


kubernetes reference The file is auto generated from the Go source code of the component using a generic contenttype tool reference weight 30 autogenerated true title kubectl

Answer:
---
title: kubectl
content_type: tool-reference
weight: 30
auto_generated: true
---

##

kubectl controls the Kubernetes cluster manager.

 Find more information at: https://kubernetes.io/docs/reference/kubectl/

```
kubectl [flags]
```

##

<colgroup>
<col span="1" style="width: 10px;" />
<col span="1" />
</colgroup>

--as string

Username to impersonate for the operation. User could be a regular user or a service account in a namespace.

--as-group strings

Group to impersonate for the operation, this flag can be repeated to specify multiple groups.

--as-uid string

UID to impersonate for the operation.

--cache-dir string     Default: "$HOME/.kube/cache"

Default cache directory

--certificate-authority string

Path to a cert file for the certificate authority

--client-certificate string

Path to a client certificate file for TLS

--client-key string

Path to a client key file for TLS

--cluster string

The name of the kubeconfig cluster to use

--context string

The name of the kubeconfig context to use

--default-not-ready-toleration-seconds int     Default: 300

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.

--default-unreachable-toleration-seconds int     Default: 300

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.

--disable-compression

If true, opt-out of response compression for all requests to the server

-h, --help

help for kubectl

--insecure-skip-tls-verify

If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure

--kubeconfig string

Path to the kubeconfig file to use for CLI requests.

--match-server-version

Require server version to match client version

-n, --namespace string

If present, the namespace scope for this CLI request

--password string

Password for basic authentication to the API server

--profile string     Default: "none"

Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)

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

Name of the file to write the profile to

--request-timeout string     Default: "0"

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.

-s, --server string

The address and port of the Kubernetes API server

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

Writes in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction

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

database name

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

database host:port

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

database password

--storage-driver-secure

use secure connection with database

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

table name

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

database username

--tls-server-name string

Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used

--token string

Bearer token for authentication to the API server

--user string

The name of the kubeconfig user to use

--username string

Username for basic authentication to the API server

--version version[=true]

--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version

--warnings-as-errors

Treat warnings received from the server as errors and exit with a non-zero exit code

##

* [kubectl annotate](../kubectl_annotate/)	 - Update the annotations on a resource
* [kubectl api-resources](../kubectl_api-resources/)	 - Print the supported API resources on the server
* [kubectl api-versions](../kubectl_api-versions/)	 - Print the supported API versions on the server, in the form of "group/version"
* [kubectl apply](../kubectl_apply/)	 - Apply a configuration to a resource by file name or stdin
* [kubectl attach](../kubectl_attach/)	 - Attach to a running container
* [kubectl auth](../kubectl_auth/)	 - Inspect authorization
* [kubectl autoscale](../kubectl_autoscale/)	 - Auto-scale a deployment, replica set, stateful set, or replication controller
* [kubectl certificate](../kubectl_certificate/)	 - Modify certificate resources
* [kubectl cluster-info](../kubectl_cluster-info/)	 - Display cluster information
* [kubectl completion](../kubectl_completion/)	 - Output shell completion code for the specified shell (bash, zsh, fish, or powershell)
* [kubectl config](../kubectl_config/)	 - Modify kubeconfig files
* [kubectl cordon](../kubectl_cordon/)	 - Mark node as unschedulable
* [kubectl cp](../kubectl_cp/)	 - Copy files and directories to and from containers
* [kubectl create](../kubectl_create/)	 - Create a resource from a file or from stdin
* [kubectl debug](../kubectl_debug/)	 - Create debugging sessions for troubleshooting workloads and nodes
* [kubectl delete](../kubectl_delete/)	 - Delete resources by file names, stdin, resources and names, or by resources and label selector
* [kubectl describe](../kubectl_describe/)	 - Show details of a specific resource or group of resources
* [kubectl diff](../kubectl_diff/)	 - Diff the live version against a would-be applied version
* [kubectl drain](../kubectl_drain/)	 - Drain node in preparation for maintenance
* [kubectl edit](../kubectl_edit/)	 - Edit a resource on the server
* [kubectl events](../kubectl_events/)	 - List events
* [kubectl exec](../kubectl_exec/)	 - Execute a command in a container
* [kubectl explain](../kubectl_explain/)	 - Get documentation for a resource
* [kubectl expose](../kubectl_expose/)	 - Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
* [kubectl get](../kubectl_get/)	 - Display one or many resources
* [kubectl kustomize](../kubectl_kustomize/)	 - Build a kustomization target from a directory or URL
* [kubectl label](../kubectl_label/)	 - Update the labels on a resource
* [kubectl logs](../kubectl_logs/)	 - Print the logs for a container in a pod
* [kubectl options](../kubectl_options/)	 - Print the list of flags inherited by all commands
* [kubectl patch](../kubectl_patch/)	 - Update fields of a resource
* [kubectl plugin](../kubectl_plugin/)	 - Provides utilities for interacting with plugins
* [kubectl port-forward](../kubectl_port-forward/)	 - Forward one or more local ports to a pod
* [kubectl proxy](../kubectl_proxy/)	 - Run a proxy to the Kubernetes API server
* [kubectl replace](../kubectl_replace/)	 - Replace a resource by file name or stdin
* [kubectl rollout](../kubectl_rollout/)	 - Manage the rollout of a resource
* [kubectl run](../kubectl_run/)	 - Run a particular image on the cluster
* [kubectl scale](../kubectl_scale/)	 - Set a new size for a deployment, replica set, or replication controller
* [kubectl set](../kubectl_set/)	 - Set specific features on objects
* [kubectl taint](../kubectl_taint/)	 - Update the taints on one or more nodes
* [kubectl top](../kubectl_top/)	 - Display resource (CPU/memory) usage
* [kubectl uncordon](../kubectl_uncordon/)	 - Mark node as schedulable
* [kubectl version](../kubectl_version/)	 - Print the client and server version information
* [kubectl wait](../kubectl_wait/)	 - Experimental: Wait for a specific condition on one or many resources

title  kubectl content type  tool reference weight  30 auto generated  true            The file is auto generated from the Go source code of the component using a generic  generator  https   github com kubernetes sigs reference docs    To learn how to generate the reference documentation  please read  Contributing to the reference documentation   docs contribute generate ref docs    To update the reference content  please follow the  Contributing upstream   docs contribute generate ref docs contribute upstream   guide  You can file document formatting bugs against the  reference docs  https   github com kubernetes sigs reference docs   project              kubectl controls the Kubernetes cluster manager    Find more information at  https   kubernetes io docs reference kubectl       kubectl  flags                table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    as string  td    tr   tr   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    tr    tr   td colspan  2    as group strings  td    tr   tr   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    tr    tr   td colspan  2    as uid string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p UID to impersonate for the operation   p   td    tr    tr   td colspan  2    cache dir string nbsp  nbsp  nbsp  nbsp  nbsp Default    HOME  kube cache   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Default cache directory  p   td    tr    tr   td colspan  2    certificate authority string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a cert file for the certificate authority  p   td    tr    tr   td colspan  2    client certificate string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client certificate file for TLS  p   td    tr    tr   td colspan  2    client key string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client key file for TLS  p   td    tr    tr   td colspan  2    cluster string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig cluster to use  p   td    tr    tr   td colspan  2    context string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig context to use  p   td    tr    tr   td colspan  2    default not ready toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   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    tr    tr   td colspan  2    default unreachable toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   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    tr    tr   td colspan  2    disable compression  td    tr   tr   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    tr    tr   td colspan  2   h    help  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p help for kubectl  p   td    tr    tr   td colspan  2    insecure skip tls verify  td    tr   tr   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    tr    tr   td colspan  2    kubeconfig string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to the kubeconfig file to use for CLI requests   p   td    tr    tr   td colspan  2    match server version  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Require server version to match client version  p   td    tr    tr   td colspan  2   n    namespace string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  the namespace scope for this CLI request  p   td    tr    tr   td colspan  2    password string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Password for basic authentication to the API server  p   td    tr    tr   td colspan  2    profile string nbsp  nbsp  nbsp  nbsp  nbsp Default   none   td    tr   tr   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    tr    tr   td colspan  2    profile output string nbsp  nbsp  nbsp  nbsp  nbsp Default   profile pprof   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of the file to write the profile to  p   td    tr    tr   td colspan  2    request timeout string nbsp  nbsp  nbsp  nbsp  nbsp Default   0   td    tr   tr   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    tr    tr   td colspan  2   s    server string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The address and port of the Kubernetes API server  p   td    tr    tr   td colspan  2    storage driver buffer duration duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Writes in the storage driver will be buffered for this duration  and committed to the non memory backends as a single transaction  p   td    tr    tr   td colspan  2    storage driver db string nbsp  nbsp  nbsp  nbsp  nbsp Default   cadvisor   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database name  p   td    tr    tr   td colspan  2    storage driver host string nbsp  nbsp  nbsp  nbsp  nbsp Default   localhost 8086   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database host port  p   td    tr    tr   td colspan  2    storage driver password string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database password  p   td    tr    tr   td colspan  2    storage driver secure  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p use secure connection with database  p   td    tr    tr   td colspan  2    storage driver table string nbsp  nbsp  nbsp  nbsp  nbsp Default   stats   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p table name  p   td    tr    tr   td colspan  2    storage driver user string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database username  p   td    tr    tr   td colspan  2    tls server name string  td    tr   tr   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    tr    tr   td colspan  2    token string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Bearer token for authentication to the API server  p   td    tr    tr   td colspan  2    user string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig user to use  p   td    tr    tr   td colspan  2    username string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username for basic authentication to the API server  p   td    tr    tr   td colspan  2    version version  true   td    tr   tr   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    tr    tr   td colspan  2    warnings as errors  td    tr   tr   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    tr     tbody    table             kubectl annotate     kubectl annotate      Update the annotations on a resource    kubectl api resources     kubectl api resources      Print the supported API resources on the server    kubectl api versions     kubectl api versions      Print the supported API versions on the server  in the form of  group version     kubectl apply     kubectl apply      Apply a configuration to a resource by file name or stdin    kubectl attach     kubectl attach      Attach to a running container    kubectl auth     kubectl auth      Inspect authorization    kubectl autoscale     kubectl autoscale      Auto scale a deployment  replica set  stateful set  or replication controller    kubectl certificate     kubectl certificate      Modify certificate resources    kubectl cluster info     kubectl cluster info      Display cluster information    kubectl completion     kubectl completion      Output shell completion code for the specified shell  bash  zsh  fish  or powershell     kubectl config     kubectl config      Modify kubeconfig files    kubectl cordon     kubectl cordon      Mark node as unschedulable    kubectl cp     kubectl cp      Copy files and directories to and from containers    kubectl create     kubectl create      Create a resource from a file or from stdin    kubectl debug     kubectl debug      Create debugging sessions for troubleshooting workloads and nodes    kubectl delete     kubectl delete      Delete resources by file names  stdin  resources and names  or by resources and label selector    kubectl describe     kubectl describe      Show details of a specific resource or group of resources    kubectl diff     kubectl diff      Diff the live version against a would be applied version    kubectl drain     kubectl drain      Drain node in preparation for maintenance    kubectl edit     kubectl edit      Edit a resource on the server    kubectl events     kubectl events      List events    kubectl exec     kubectl exec      Execute a command in a container    kubectl explain     kubectl explain      Get documentation for a resource    kubectl expose     kubectl expose      Take a replication controller  service  deployment or pod and expose it as a new Kubernetes service    kubectl get     kubectl get      Display one or many resources    kubectl kustomize     kubectl kustomize      Build a kustomization target from a directory or URL    kubectl label     kubectl label      Update the labels on a resource    kubectl logs     kubectl logs      Print the logs for a container in a pod    kubectl options     kubectl options      Print the list of flags inherited by all commands    kubectl patch     kubectl patch      Update fields of a resource    kubectl plugin     kubectl plugin      Provides utilities for interacting with plugins    kubectl port forward     kubectl port forward      Forward one or more local ports to a pod    kubectl proxy     kubectl proxy      Run a proxy to the Kubernetes API server    kubectl replace     kubectl replace      Replace a resource by file name or stdin    kubectl rollout     kubectl rollout      Manage the rollout of a resource    kubectl run     kubectl run      Run a particular image on the cluster    kubectl scale     kubectl scale      Set a new size for a deployment  replica set  or replication controller    kubectl set     kubectl set      Set specific features on objects    kubectl taint     kubectl taint      Update the taints on one or more nodes    kubectl top     kubectl top      Display resource  CPU memory  usage    kubectl uncordon     kubectl uncordon      Mark node as schedulable    kubectl version     kubectl version      Print the client and server version information    kubectl wait     kubectl wait      Experimental  Wait for a specific condition on one or many resources


kubernetes reference nolist true contenttype tool reference weight 30 title kubectl attach autogenerated true

Answer:
---
title: kubectl attach
content_type: tool-reference
weight: 30
auto_generated: true
no_list: true
---

##

Attach to a process that is already running inside an existing container.

```
kubectl attach (POD | TYPE/NAME) -c CONTAINER
```

##

```
  # Get output from running pod mypod; use the 'kubectl.kubernetes.io/default-container' annotation
  # for selecting the container to be attached or the first container in the pod will be chosen
  kubectl attach mypod

  # Get output from ruby-container from pod mypod
  kubectl attach mypod -c ruby-container

  # Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod
  # and sends stdout/stderr from 'bash' back to the client
  kubectl attach mypod -c ruby-container -i -t

  # Get output from the first pod of a replica set named nginx
  kubectl attach rs/nginx
```

##

<colgroup>
<col span="1" style="width: 10px;" />
<col span="1" />
</colgroup>

-c, --container string

Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen

-h, --help

help for attach

--pod-running-timeout duration     Default: 1m0s

The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running

-q, --quiet

Only print output from the remote session

-i, --stdin

Pass stdin to the container

-t, --tty

Stdin is a TTY

##

<colgroup>
<col span="1" style="width: 10px;" />
<col span="1" />
</colgroup>

--as string

Username to impersonate for the operation. User could be a regular user or a service account in a namespace.

--as-group strings

Group to impersonate for the operation, this flag can be repeated to specify multiple groups.

--as-uid string

UID to impersonate for the operation.

--cache-dir string     Default: "$HOME/.kube/cache"

Default cache directory

--certificate-authority string

Path to a cert file for the certificate authority

--client-certificate string

Path to a client certificate file for TLS

--client-key string

Path to a client key file for TLS

--cluster string

The name of the kubeconfig cluster to use

--context string

The name of the kubeconfig context to use

--default-not-ready-toleration-seconds int     Default: 300

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.

--default-unreachable-toleration-seconds int     Default: 300

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.

--disable-compression

If true, opt-out of response compression for all requests to the server

--insecure-skip-tls-verify

If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure

--kubeconfig string

Path to the kubeconfig file to use for CLI requests.

--match-server-version

Require server version to match client version

-n, --namespace string

If present, the namespace scope for this CLI request

--password string

Password for basic authentication to the API server

--profile string     Default: "none"

Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)

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

Name of the file to write the profile to

--request-timeout string     Default: "0"

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.

-s, --server string

The address and port of the Kubernetes API server

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

Writes in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction

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

database name

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

database host:port

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

database password

--storage-driver-secure

use secure connection with database

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

table name

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

database username

--tls-server-name string

Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used

--token string

Bearer token for authentication to the API server

--user string

The name of the kubeconfig user to use

--username string

Username for basic authentication to the API server

--version version[=true]

--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version

--warnings-as-errors

Treat warnings received from the server as errors and exit with a non-zero exit code

##

* [kubectl](../kubectl/)	 - kubectl controls the Kubernetes cluster manager

title  kubectl attach content type  tool reference weight  30 auto generated  true no list  true            The file is auto generated from the Go source code of the component using a generic  generator  https   github com kubernetes sigs reference docs    To learn how to generate the reference documentation  please read  Contributing to the reference documentation   docs contribute generate ref docs    To update the reference content  please follow the  Contributing upstream   docs contribute generate ref docs contribute upstream   guide  You can file document formatting bugs against the  reference docs  https   github com kubernetes sigs reference docs   project              Attach to a process that is already running inside an existing container       kubectl attach  POD   TYPE NAME   c CONTAINER                   Get output from running pod mypod  use the  kubectl kubernetes io default container  annotation     for selecting the container to be attached or the first container in the pod will be chosen   kubectl attach mypod        Get output from ruby container from pod mypod   kubectl attach mypod  c ruby container        Switch to raw terminal mode  sends stdin to  bash  in ruby container from pod mypod     and sends stdout stderr from  bash  back to the client   kubectl attach mypod  c ruby container  i  t        Get output from the first pod of a replica set named nginx   kubectl attach rs nginx               table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2   c    container string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Container name  If omitted  use the kubectl kubernetes io default container annotation for selecting the container to be attached or the first container in the pod will be chosen  p   td    tr    tr   td colspan  2   h    help  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p help for attach  p   td    tr    tr   td colspan  2    pod running timeout duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The length of time  like 5s  2m  or 3h  higher than zero  to wait until at least one pod is running  p   td    tr    tr   td colspan  2   q    quiet  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Only print output from the remote session  p   td    tr    tr   td colspan  2   i    stdin  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Pass stdin to the container  p   td    tr    tr   td colspan  2   t    tty  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Stdin is a TTY  p   td    tr     tbody    table              table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    as string  td    tr   tr   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    tr    tr   td colspan  2    as group strings  td    tr   tr   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    tr    tr   td colspan  2    as uid string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p UID to impersonate for the operation   p   td    tr    tr   td colspan  2    cache dir string nbsp  nbsp  nbsp  nbsp  nbsp Default    HOME  kube cache   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Default cache directory  p   td    tr    tr   td colspan  2    certificate authority string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a cert file for the certificate authority  p   td    tr    tr   td colspan  2    client certificate string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client certificate file for TLS  p   td    tr    tr   td colspan  2    client key string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client key file for TLS  p   td    tr    tr   td colspan  2    cluster string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig cluster to use  p   td    tr    tr   td colspan  2    context string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig context to use  p   td    tr    tr   td colspan  2    default not ready toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   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    tr    tr   td colspan  2    default unreachable toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   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    tr    tr   td colspan  2    disable compression  td    tr   tr   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    tr    tr   td colspan  2    insecure skip tls verify  td    tr   tr   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    tr    tr   td colspan  2    kubeconfig string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to the kubeconfig file to use for CLI requests   p   td    tr    tr   td colspan  2    match server version  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Require server version to match client version  p   td    tr    tr   td colspan  2   n    namespace string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  the namespace scope for this CLI request  p   td    tr    tr   td colspan  2    password string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Password for basic authentication to the API server  p   td    tr    tr   td colspan  2    profile string nbsp  nbsp  nbsp  nbsp  nbsp Default   none   td    tr   tr   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    tr    tr   td colspan  2    profile output string nbsp  nbsp  nbsp  nbsp  nbsp Default   profile pprof   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of the file to write the profile to  p   td    tr    tr   td colspan  2    request timeout string nbsp  nbsp  nbsp  nbsp  nbsp Default   0   td    tr   tr   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    tr    tr   td colspan  2   s    server string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The address and port of the Kubernetes API server  p   td    tr    tr   td colspan  2    storage driver buffer duration duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Writes in the storage driver will be buffered for this duration  and committed to the non memory backends as a single transaction  p   td    tr    tr   td colspan  2    storage driver db string nbsp  nbsp  nbsp  nbsp  nbsp Default   cadvisor   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database name  p   td    tr    tr   td colspan  2    storage driver host string nbsp  nbsp  nbsp  nbsp  nbsp Default   localhost 8086   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database host port  p   td    tr    tr   td colspan  2    storage driver password string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database password  p   td    tr    tr   td colspan  2    storage driver secure  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p use secure connection with database  p   td    tr    tr   td colspan  2    storage driver table string nbsp  nbsp  nbsp  nbsp  nbsp Default   stats   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p table name  p   td    tr    tr   td colspan  2    storage driver user string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database username  p   td    tr    tr   td colspan  2    tls server name string  td    tr   tr   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    tr    tr   td colspan  2    token string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Bearer token for authentication to the API server  p   td    tr    tr   td colspan  2    user string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig user to use  p   td    tr    tr   td colspan  2    username string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username for basic authentication to the API server  p   td    tr    tr   td colspan  2    version version  true   td    tr   tr   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    tr    tr   td colspan  2    warnings as errors  td    tr   tr   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    tr     tbody    table             kubectl     kubectl      kubectl controls the Kubernetes cluster manager