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

22 KiB

title notitle
kubectl true

kubectl

kubectl controls the Kubernetes cluster manager

Synopsis

kubectl controls the Kubernetes cluster manager.

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

kubectl [flags]

Options

<tr>
  <td colspan="2">--alsologtostderr</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">log to standard error as well as files</td>
</tr>

<tr>
  <td colspan="2">--application-metrics-count-limit int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 100</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Max number of application metrics to store (per container)</td>
</tr>

<tr>
  <td colspan="2">--as string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Username to impersonate for the operation</td>
</tr>

<tr>
  <td colspan="2">--as-group stringArray</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Group to impersonate for the operation, this flag can be repeated to specify multiple groups.</td>
</tr>

<tr>
  <td colspan="2">--azure-container-registry-config string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Path to the file containing Azure container registry configuration information.</td>
</tr>

<tr>
  <td colspan="2">--boot-id-file string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "/proc/sys/kernel/random/boot_id"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Comma-separated list of files to check for boot-id. Use the first one that exists.</td>
</tr>

<tr>
  <td colspan="2">--cache-dir string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "/home/tengqm/.kube/http-cache"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Default HTTP cache directory</td>
</tr>

<tr>
  <td colspan="2">--certificate-authority string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Path to a cert file for the certificate authority</td>
</tr>

<tr>
  <td colspan="2">--client-certificate string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Path to a client certificate file for TLS</td>
</tr>

<tr>
  <td colspan="2">--client-key string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Path to a client key file for TLS</td>
</tr>

<tr>
  <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>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">CIDRs opened in GCE firewall for LB traffic proxy & health checks</td>
</tr>

<tr>
  <td colspan="2">--cluster string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">The name of the kubeconfig cluster to use</td>
</tr>

<tr>
  <td colspan="2">--container-hints string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "/etc/cadvisor/container_hints.json"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">location of the container hints file</td>
</tr>

<tr>
  <td colspan="2">--containerd string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "unix:///var/run/containerd.sock"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">containerd endpoint</td>
</tr>

<tr>
  <td colspan="2">--context string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">The name of the kubeconfig context to use</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;">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.</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;">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.</td>
</tr>

<tr>
  <td colspan="2">--docker string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "unix:///var/run/docker.sock"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">docker endpoint</td>
</tr>

<tr>
  <td colspan="2">--docker-env-metadata-whitelist string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">a comma-separated list of environment variable keys that needs to be collected for docker containers</td>
</tr>

<tr>
  <td colspan="2">--docker-only</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Only report docker containers in addition to root stats</td>
</tr>

<tr>
  <td colspan="2">--docker-root string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "/var/lib/docker"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">DEPRECATED: docker root is read from docker info (this is a fallback, default: /var/lib/docker)</td>
</tr>

<tr>
  <td colspan="2">--docker-tls</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">use TLS to connect to docker</td>
</tr>

<tr>
  <td colspan="2">--docker-tls-ca string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "ca.pem"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">path to trusted CA</td>
</tr>

<tr>
  <td colspan="2">--docker-tls-cert string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "cert.pem"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">path to client certificate</td>
</tr>

<tr>
  <td colspan="2">--docker-tls-key string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "key.pem"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">path to private key</td>
</tr>

<tr>
  <td colspan="2">--enable-load-reader</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Whether to enable cpu load reader</td>
</tr>

<tr>
  <td colspan="2">--event-storage-age-limit string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "default=0"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Max length of time for which to store events (per type). Value is a comma separated list of key values, where the keys are event types (e.g.: creation, oom) or "default" and the value is a duration. Default is applied to all non-specified event types</td>
</tr>

<tr>
  <td colspan="2">--event-storage-event-limit string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "default=0"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Max number of events to store (per type). Value is a comma separated list of key values, where the keys are event types (e.g.: creation, oom) or "default" and the value is an integer. Default is applied to all non-specified event types</td>
</tr>

<tr>
  <td colspan="2">--global-housekeeping-interval duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 1m0s</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Interval between global housekeepings</td>
</tr>

<tr>
  <td colspan="2">-h, --help</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">help for kubectl</td>
</tr>

<tr>
  <td colspan="2">--housekeeping-interval duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 10s</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Interval between container housekeepings</td>
</tr>

<tr>
  <td colspan="2">--insecure-skip-tls-verify</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure</td>
</tr>

<tr>
  <td colspan="2">--kubeconfig string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Path to the kubeconfig file to use for CLI requests.</td>
</tr>

<tr>
  <td colspan="2">--log-backtrace-at traceLocation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: :0</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">when logging hits line file:N, emit a stack trace</td>
</tr>

<tr>
  <td colspan="2">--log-cadvisor-usage</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Whether to log the usage of the cAdvisor container</td>
</tr>

<tr>
  <td colspan="2">--log-dir string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">If non-empty, write log files in this directory</td>
</tr>

<tr>
  <td colspan="2">--log-file string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">If non-empty, use this log file</td>
</tr>

<tr>
  <td colspan="2">--log-flush-frequency duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 5s</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Maximum number of seconds between log flushes</td>
</tr>

<tr>
  <td colspan="2">--logtostderr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: true</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">log to standard error instead of files</td>
</tr>

<tr>
  <td colspan="2">--machine-id-file string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "/etc/machine-id,/var/lib/dbus/machine-id"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Comma-separated list of files to check for machine-id. Use the first one that exists.</td>
</tr>

<tr>
  <td colspan="2">--match-server-version</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Require server version to match client version</td>
</tr>

<tr>
  <td colspan="2">--mesos-agent string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "127.0.0.1:5051"</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Mesos agent address</td>
</tr>

<tr>
  <td colspan="2">--mesos-agent-timeout duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 10s</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Mesos agent timeout</td>
</tr>

<tr>
  <td colspan="2">-n, --namespace string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">If present, the namespace scope for this CLI request</td>
</tr>

<tr>
  <td colspan="2">--password string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Password for basic authentication to the API server</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;">Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)</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;">Name of the file to write the profile to</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;">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.</td>
</tr>

<tr>
  <td colspan="2">-s, --server string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">The address and port of the Kubernetes API server</td>
</tr>

<tr>
  <td colspan="2">--skip-headers</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">If true, avoid header prefixes in the log messages</td>
</tr>

<tr>
  <td colspan="2">--stderrthreshold severity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 2</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">logs at or above this threshold go to stderr</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;">Writes in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction</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;">database name</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;">database host:port</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;">database password</td>
</tr>

<tr>
  <td colspan="2">--storage-driver-secure</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">use secure connection with database</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;">table name</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;">database username</td>
</tr>

<tr>
  <td colspan="2">--token string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Bearer token for authentication to the API server</td>
</tr>

<tr>
  <td colspan="2">--update-machine-info-interval duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 5m0s</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Interval between machine info updates.</td>
</tr>

<tr>
  <td colspan="2">--user string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">The name of the kubeconfig user to use</td>
</tr>

<tr>
  <td colspan="2">--username string</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Username for basic authentication to the API server</td>
</tr>

<tr>
  <td colspan="2">-v, --v Level</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">number for the log level verbosity</td>
</tr>

<tr>
  <td colspan="2">--version version[=true]</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">Print version information and quit</td>
</tr>

<tr>
  <td colspan="2">--vmodule moduleSpec</td>
</tr>
<tr>
  <td></td><td style="line-height: 130%; word-wrap: break-word;">comma-separated list of pattern=N settings for file-filtered logging</td>
</tr>

SEE ALSO