# kubectl

kubectlSynopsiskubectl controls the Kubernetes cluster manager.Find more information in Command line tool (kubectl).kubectl [flags] Options--add-dir-headerIf true, adds the file directory to the header of the log messages--alsologtostderrlog to standard error as well as files--as stringUsername to impersonate for the operation--as-group stringArrayGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--azure-container-registry-config stringPath to the file containing Azure container registry configuration information.--cache-dir string Default: "$HOME/.kube/cache"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cloud-provider-gce-l7lb-src-cidrs cidrs Default: 130.211.0.0/22,35.191.0.0/16CIDRs opened in GCE firewall for L7 LB traffic proxy & health checks--cloud-provider-gce-lb-src-cidrs cidrs Default: 130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--default-not-ready-toleration-seconds int Default: 300Indicates 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: 300Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.-h, --helphelp for kubectl--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--log-backtrace-at traceLocation Default: :0when logging hits line file:N, emit a stack trace--log-dir stringIf non-empty, write log files in this directory--log-file stringIf non-empty, use this log file--log-file-max-size uint Default: 1800Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited.--log-flush-frequency duration Default: 5sMaximum number of seconds between log flushes--logtostderr Default: truelog to standard error instead of files--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--one-outputIf true, only write logs to their native severity level (vs also writing to each lower severity level)--password stringPassword 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 stringThe address and port of the Kubernetes API server--skip-headersIf true, avoid header prefixes in the log messages--skip-log-headersIf true, avoid headers when opening log files--stderrthreshold severity Default: 2logs at or above this threshold go to stderr--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server-v, --v Levelnumber for the log level verbosity--version version[=true]Print version information and quit--vmodule moduleSpeccomma-separated list of pattern=N settings for file-filtered logging--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeEnvironment variablesKUBECONFIGPath to the kubectl configuration ("kubeconfig") file. Default: "$HOME/.kube/config"KUBECTL_COMMAND_HEADERSWhen set to false, turns off extra HTTP headers detailing invoked kubectl command (Kubernetes version v1.22 or later)KUBECTL_EXPLAIN_OPENAPIV3Toggles whether calls to `kubectl explain` use the new OpenAPIv3 data source available. OpenAPIV3 is enabled by default since Kubernetes 1.24.KUBECTL_ENABLE_CMD_SHADOWWhen set to true, external plugins can be used as subcommands for builtin commands if subcommand does not exist. In alpha stage, this feature can only be used for create command(e.g. kubectl create networkpolicy).KUBECTL_PORT_FORWARD_WEBSOCKETSWhen set to true, the kubectl port-forward command will attempt to stream using the websockets protocol. If the upgrade to websockets fails, the commands will fallback to use the current SPDY protocol.KUBECTL_REMOTE_COMMAND_WEBSOCKETSWhen set to true, the kubectl exec, cp, and attach commands will attempt to stream using the websockets protocol. If the upgrade to websockets fails, the commands will fallback to use the current SPDY protocol.KUBECTL_KUBERCWhen set to true, kuberc file is taken into account to define user specific preferences.See Alsokubectl annotate - Update the annotations on a resourcekubectl api-resources - Print the supported API resources on the serverkubectl api-versions - Print the supported API versions on the server, in the form of "group/version"kubectl apply - Apply a configuration to a resource by filename or stdinkubectl attach - Attach to a running containerkubectl auth - Inspect authorizationkubectl autoscale - Auto-scale a Deployment, ReplicaSet, or ReplicationControllerkubectl certificate - Modify certificate resources.kubectl cluster-info - Display cluster infokubectl completion - Output shell completion code for the specified shell (bash or zsh)kubectl config - Modify kubeconfig fileskubectl cordon - Mark node as unschedulablekubectl cp - Copy files and directories to and from containers.kubectl create - Create a resource from a file or from stdin.kubectl debug - Create debugging sessions for troubleshooting workloads and nodeskubectl delete - Delete resources by filenames, stdin, resources and names, or by resources and label selectorkubectl describe - Show details of a specific resource or group of resourceskubectl diff - Diff live version against would-be applied versionkubectl drain - Drain node in preparation for maintenancekubectl edit - Edit a resource on the serverkubectl events - List eventskubectl exec - Execute a command in a containerkubectl explain - Documentation of resourceskubectl expose - Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Servicekubectl get - Display one or many resourceskubectl kustomize - Build a kustomization target from a directory or a remote url.kubectl label - Update the labels on a resourcekubectl logs - Print the logs for a container in a podkubectl options - Print the list of flags inherited by all commandskubectl patch - Update field(s) of a resourcekubectl plugin - Provides utilities for interacting with plugins.kubectl port-forward - Forward one or more local ports to a podkubectl proxy - Run a proxy to the Kubernetes API serverkubectl replace - Replace a resource by filename or stdinkubectl rollout - Manage the rollout of a resourcekubectl run - Run a particular image on the clusterkubectl scale - Set a new size for a Deployment, ReplicaSet or Replication Controllerkubectl set - Set specific features on objectskubectl taint - Update the taints on one or more nodeskubectl top - Display Resource (CPU/Memory/Storage) usage.kubectl uncordon - Mark node as schedulablekubectl version - Print the client and server version informationkubectl wait - Experimental: Wait for a specific condition on one or many resources.