text
stringlengths
1
1k
id
int64
0
8.58k
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 See Also kubectl create service - Create a service using a specified subcommand kubectl create service externalname Synopsis Create an ExternalName service with the specified name. ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference services that exist off platform, on other clusters, or locally. kubectl create service externalname NAME --external-name external.name [--dry-run=server| client|none] Examples # Create a new ExternalName service named my-ns kubectl create service externalname my-ns --external-name bar.com Options --allow-missing-template-keys     D
6,600
efault: true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. --dry-run string[="unchanged"]     Default: "none"
6,601
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. --external-name string External name of service --field-manager string     Default: "kubectl-create" Name of the manager used to track field ownership. -h, --help help for externalname -o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file). --save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. --show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format. --tcp strings Port pairs can be specified as '<port>:<targetPort>'. --template string Template string or path to template file
6,602
to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. --validate string[="strict"]     Default: "strict" Must be one of: strict (or true), warn, ignore (or false). "true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. "warn" will warn about unknown or duplicate fields without blocking the request if server- side field validation is enabled on the API server, and behave as "ignore" otherwise. "false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields
6,603
--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. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traf
6,604
fic proxy & health checks --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: 30
6,605
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
6,606
|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 serve
6,607
--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 info
6,608
rmation and quits; --version=vX.Y.Z... sets the reported version --warnings-as-error
6,609
Treat warnings received from the server as errors and exit with a non-zero exit code See Also kubectl create service - Create a service using a specified subcommand kubectl create service loadbalancer Synopsis Create a LoadBalancer service with the specified name. kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client| none] Examples # Create a new LoadBalancer service named my-lbs kubectl create service loadbalancer my-lbs --tcp=5678:8080 Options --allow-missing-template-keys     Default: true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. --dry-run string[="unchanged"]     Default: "none" Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. --field-manager string     Default: "kubectl-create" Name of the
6,610
manager used to track field ownership. -h, --help help for loadbalancer -o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
6,611
--save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. --show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format. --tcp strings Port pairs can be specified as '<port>:<targetPort>'. --template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. --validate string[="strict"]     Default: "strict" Must be one of: strict (or true), warn, ignore (or false). "true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. "warn" will warn about unknown or dupl
6,612
icate fields without blocking the request if server- side field validation is enabled on the API server, and behave as "ignore" otherwise. "false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields. --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. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --cache-dir string     Default: "$HOME/.kube/cache" Default cache director
6,613
--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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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 unreacha
6,614
ble: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
6,615
--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 --stor
6,616
age-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
6,617
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 See Also kubectl create service - Create a service using a specified subcommand kubectl create service nodeport Synopsis Create a NodePort service with the specified name. kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]•
6,618
Examples # Create a new NodePort service named my-ns kubectl create service nodeport my-ns --tcp=5678:8080 Options --allow-missing-template-keys     Default: true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. --dry-run string[="unchanged"]     Default: "none" Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. --field-manager string     Default: "kubectl-create" Name of the manager used to track field ownership. -h, --help help for nodeport --node-port int Port used to expose the service on each node in a cluster. -o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file). --save-config If true, the configuration of current object will be s
6,619
aved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. --show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format. --tcp strings Port pairs can be specified as '<port>:<targetPort>'. --template strin
6,620
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. --validate string[="strict"]     Default: "strict" Must be one of: strict (or true), warn, ignore (or false). "true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. "warn" will warn about unknown or duplicate fields without blocking the request if server- side field validation is enabled on the API server, and behave as "ignore" otherwise. "false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields. --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 f
6,621
or the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/1
6,622
CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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. Th
6,623
is 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
6,624
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"
6,625
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 strin
6,626
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 See Also kubectl create service - Create a service using a specified subcommand kubectl create serviceaccount Synopsis Create a service account with the specified name. kubectl create serviceaccount NAME [--dry-run=server|client|none] Examples # Create a new service account named my-service-account kubectl create serviceaccount my-service-account Options --allow-missing-template-keys     Default: true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. --dry-run string[="unchanged"]   
6,627
  Default: "none"
6,628
Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. --field-manager string     Default: "kubectl-create" Name of the manager used to track field ownership. -h, --help help for serviceaccount -o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file). --save-config If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. --show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format. --template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/te
6,629
xt/template/#pkg-overview]. --validate string[="strict"]     Default: "strict" Must be one of: strict (or true), warn, ignore (or false). "true" or "strict" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. "warn" will warn about unknown or duplicate fields without blocking the request if server- side field validation is enabled on the API server, and behave as "ignore" otherwise. "false" or "ignore" will not perform any schema validation, silently dropping any unknown or duplicate fields. --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. --as-group string
6,630
Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --cluster string The name of the kubeconfig cluster to use --context string The name of the kubeconfig context to
6,631
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: 30
6,632
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
6,633
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 transactio
6,634
--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
6,635
See Also kubectl create - Create a resource from a file or from stdin kubectl create token Synopsis Request a service account token. kubectl create token SERVICE_ACCOUNT_NAME Examples # Request a token to authenticate to the kube-apiserver as the service account "myapp" in the current namespace kubectl create token myapp # Request a token for a service account in a custom namespace kubectl create token myapp --namespace myns # Request a token with a custom expiration kubectl create token myapp --duration 10m # Request a token with a custom audience kubectl create token myapp --audience https://example.com # Request a token bound to an instance of a Secret object kubectl create token myapp --bound-object-kind Secret --bound-object-name mysecret # Request a token bound to an instance of a Secret object with a specific UID kubectl create token myapp --bound-object-kind Secret --bound-object-name mysecret -- bound-object-uid 0d4691ed-659b-4935-a832-
6,636
355f77ee47cc Options --allow-missing-template-keys     Default: true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. --audience strings Audience of the requested token. If unset, defaults to requesting a token for use with the Kubernetes API server. May be repeated to request a token valid for multiple audiences. --bound-object-kind string
6,637
Kind of an object to bind the token to. Supported kinds are Pod, Secret. If set, --bound-object- name must be provided. --bound-object-name string Name of an object to bind the token to. The token will expire when the object is deleted. Requires --bound-object-kind. --bound-object-uid string UID of an object to bind the token to. Requires --bound-object-kind and --bound-object-name. If unset, the UID of the existing object is used. --duration duration Requested lifetime of the issued token. If not set, the lifetime will be determined by the server automatically. The server may return a token with a longer or shorter lifetime. -h, --help help for token -o, --output string Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file). --show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format. --template string Template string or path to template file to use when -o=go-te
6,638
mplate, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. --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. --azure-container-registry-config strin
6,639
Path to the file containing Azure container registry configuration information. --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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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
6,640
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-verif
6,641
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
6,642
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
6,643
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 See Also kubectl create - Create a resource from a file or from stdin •
6,644
kubectl debug Synopsis Debug cluster resources using interactive debugging containers. 'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resource is specified. The action taken by 'debug' varies depending on what resource is specified. Supported actions include: Workload: Create a copy of an existing pod with certain attributes changed, for example changing the image tag to a new version. Workload: Add an ephemeral container to an already running pod, for example to add debugging utilities without restarting the pod. Node: Create a new pod that runs in the node's host namespaces and can access the node's filesystem. kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ] Examples # Create an interactive debugging session in pod mypod and immediately attach to it. kubectl debug mypod -it --image=busybox # Create an interactive debugging session for the pod in the file
6,645
pod.yaml and immediately attach to it. # (requires the EphemeralContainers feature to be enabled in the cluster) kubectl debug -f pod.yaml -it --image=busybox # Create a debug container named debugger using a custom automated debugging image. kubectl debug --image=myproj/debug-tools -c debugger mypod # Create a copy of mypod adding a debug container and attach to it kubectl debug mypod -it --image=busybox --copy-to=my-debugger # Create a copy of mypod changing the command of mycontainer kubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh # Create a copy of mypod changing all container images to busybox kubectl debug mypod --copy-to=my-debugger --set-image=*=busybox # Create a copy of mypod adding a debug container and changing container images kubectl debug mypod -it --copy-to=my-debugger --image=debian --set- image=app=app:debug,sidecar=sidecar:debug # Create an interactive debugging session on a node and immediatel
6,646
y attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at / host kubectl debug node/mynode -it --image=busybox• •
6,647
Options --arguments-only If specified, everything after -- will be passed to the new container as Args instead of Command. --attach If true, wait for the container to start running, and then attach as if 'kubectl attach ...' were called. Default false, unless '-i/--stdin' is set, in which case the default is true. -c, --container string Container name to use for debug container. --copy-to string Create a copy of the target Pod with this name. --env stringToString     Default: [] Environment variables to set in the container. -f, --filename strings identifying the resource to debug -h, --help help for debug --image string Container image to use for debug container. --image-pull-policy string The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server. --profile string     Default: "legacy" Debugging profile. Options are "legacy", "general", "baseline", "netadmin", or "restricted". -q, --quiet If true, suppress inform
6,648
ational messages. --replac
6,649
When used with '--copy-to', delete the original Pod. --same-node When used with '--copy-to', schedule the copy of target Pod on the same node. --set-image stringToString     Default: [] When used with '--copy-to', a list of name=image pairs for changing container images, similar to how 'kubectl set image' works. --share-processes     Default: true When used with '--copy-to', enable process namespace sharing in the copy. -i, --stdin Keep stdin open on the container(s) in the pod, even if nothing is attached. --target string When using an ephemeral container, target processes in this container name. -t, --tty Allocate a TTY for the debugging container. --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. --azure-container-registry-config string Path to the
6,650
file containing Azure container registry configuration information. --cache-dir string     Default: "$HOME/.kube/cache" Default cache directory --certificate-authority strin
6,651
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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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
6,652
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-versio
6,653
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-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 --s
6,654
torage-driver-secure use secure connection with database --storage-driver-table string     Default: "stats" table name --storage-driver-user string     Default: "root
6,655
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 See Also kubectl - kubectl controls the Kubernetes cluster manager kubectl delete Synopsis Delete resources by file names, stdin, resources and names, or by resources and label selector. JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector. Some resources, such as pods, support graceful deletion. These resourc
6,656
es define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a
6,657
subset of resources support graceful deletion. In absence of the support, the --grace-period flag is ignored. IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods, the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately. Note that the delete command does NOT do resource version
6,658
checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource. After a CustomResourceDefinition is deleted, invalidation of discovery cache may take up to 6 hours. If you don't want to wait, you might want to run "kubectl api-resources" to refresh the discovery cache. kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)]) Examples # Delete a pod using the type and name specified in pod.json kubectl delete -f ./pod.json # Delete resources from a directory containing kustomization.yaml - e.g. dir/ kustomization.yaml kubectl delete -k dir # Delete resources from all files that end with '.json' kubectl delete -f '*.json' # Delete a pod based on the type and name in the JSON passed into stdin cat pod.json | kubectl delete -f - # Delete pods and services with same names "baz" and "foo" kubectl delete pod,service baz foo # Delete pods and servi
6,659
ces with label name=myLabel kubectl delete pods,services -l name=myLabel # Delete a pod with minimal delay kubectl delete pod foo --now # Force delete a pod on a dead node kubectl delete pod foo --force # Delete all pods kubectl delete pods --al
6,660
Options --all Delete all resources, in the namespace of the specified resource types. -A, --all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. --cascade string[="background"]     Default: "background" Must be "background", "orphan", or "foreground". Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background. --dry-run string[="unchanged"]     Default: "none" Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. --field-selector string Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. -f, --filename strings containing the resource to delet
6,661
e. --force If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. --grace-period int     Default: -1 Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion). -h, --help help for delete --ignore-not-found Treat "resource not found" as a successful delete. Defaults to "true" when --all is specified
6,662
-i, --interactive If true, delete resource only when user confirms. This flag is in Alpha. -k, --kustomize string Process a kustomization directory. This flag can't be used together with -f or -R. --now If true, resources are signaled for immediate shutdown (same as --grace-period=1). -o, --output string Output mode. Use "-o name" for shorter output (resource/name). --raw string Raw URI to DELETE to the server. Uses the transport specified by the kubeconfig file. -R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. -l, --selector string Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints. --timeout duration The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object --wait     Default: true If true, wait for r
6,663
esources to be gone before returning. This waits for finalizers. --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 strin
6,664
UID to impersonate for the operation. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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 tolerat
6,665
ion 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-compressio
6,666
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
6,667
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
6,668
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 See Also kubectl - kubectl controls the Kubernetes cluster manager •
6,669
kubectl describe Synopsis Show details of a specific resource or group of resources. Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a name prefix, or label selector. For example: $ kubectl describe TYPE NAME_PREFIX will first check for an exact match on TYPE and NAME_PREFIX. If no such resource exists, it will output details for every resource that has a name prefixed with NAME_PREFIX. Use "kubectl api-resources" for a complete list of supported resources. kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME) Examples # Describe a node kubectl describe nodes kubernetes-node-emt8.c.myproject.internal # Describe a pod kubectl describe pods/nginx # Describe a pod identified by type and name in "pod.json" kubectl describe -f pod.json # Describe all pods kubectl describe pods # Describe pods by la
6,670
bel name=myLabel kubectl describe pods -l name=myLabel # Describe all pods managed by the 'frontend' replication controller # (rc-created pods get the name of the rc as a prefix in the pod name) kubectl describe pods frontend Options -A, --all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. --chunk-size int     Default: 50
6,671
Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future. -f, --filename strings Filename, directory, or URL to files containing the resource to describe -h, --help help for describe -k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R. -R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. -l, --selector string Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints. --show-events     Default: true If true, display events related to the described object. --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 repeate
6,672
d to specify multiple groups. --as-uid string UID to impersonate for the operation. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --cache-dir string     Default: "$HOME/.kube/cache" Default cache director
6,673
--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 --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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 unreacha
6,674
ble: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
6,675
--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 --stor
6,676
age-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
6,677
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 See Also kubectl - kubectl controls the Kubernetes cluster manager kubectl diff Synopsis Diff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied. The output is always YAML. KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff comma
6,678
nd. Users can use external commands with params too, example: KUBECTL_EXTERNAL_DIFF="colordiff -N -u"
6,679
By default, the "diff" command available in your path will be run with the "-u" (unified diff) and "-N" (treat absent files as empty) options. Exit status: 0 No differences were found. 1 Differences were found. >1 Kubectl or diff failed with an error. Note: KUBECTL_EXTERNAL_DIFF, if used, is expected to follow that convention. kubectl diff -f FILENAME Examples # Diff resources included in pod.json kubectl diff -f pod.json # Diff file read from stdin cat service.yaml | kubectl diff -f - Options --concurrency int     Default: 1 Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time. --field-manager string     Default: "kubectl-client-side-apply" Name of the manager used to track field ownership. -f, --filename strings Filename, directory, or URL to files contains the configuration to diff --force-conflicts If true, server-side apply will force the changes against conf
6,680
licts. -h, --help help for diff -k, --kustomize string Process the kustomization directory. This flag can't be used together with -f or -R. --prune Include resources that would be deleted by pruning. Can be used with -l and default shows all resources would be pruned --prune-allowlist string
6,681
Overwrite the default whitelist with <group/version/kind> for --prune -R, --recursive Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. -l, --selector string Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints. --server-side If true, apply runs in the server instead of the client. --show-managed-fields If true, include managed fields in the diff. --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. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --cache-dir string     Default
6,682
: "$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 strin
6,683
Path to a client key file for TLS --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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 re
6,684
quests 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 strin
6,685
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-secu
6,686
re use secure connection with database --storage-driver-table string     Default: "stats" table name --storage-driver-user string     Default: "root" database username --tls-server-name strin
6,687
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 See Also kubectl - kubectl controls the Kubernetes cluster manager kubectl drain Synopsis Drain node in preparation for maintenance. The given node will be marked unschedulable to prevent new pods from arriving. 'drain' evicts the pods if the API server supports https://kubernetes.io/docs/concepts/workloads/pods/ disruptions/ eviction https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ . Otherwise, it will use normal DELETE to d
6,688
elete the pods. The 'drain' evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are daemon set- managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any daemon set-managed pods, because those pods would be immediately replaced by the daemon set controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by a replication controller, replica set, daemon set, stateful set, or job, then drain will not delete any pods unless you use --force. --force will also allow deletion to proceed if the managing resource of one or more pods is missing. 'drain' waits for graceful termination. You should not operate on the machine until the command completes.
6,689
When you are ready to put the node back into service, use kubectl uncordon, which will make the node schedulable again. https://kubernetes.io/images/docs/kubectl_drain.svg Workflowhttps://kubernetes.io/images/ docs/kubectl_drain.svg kubectl drain NODE Examples # Drain node "foo", even if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set on it kubectl drain foo --force # As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set, and use a grace period of 15 minutes kubectl drain foo --grace-period=900 Options --chunk-size int     Default: 500 Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future. --delete-emptydir-data Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained). --disable-eviction Force drain to use delete, even if eviction is su
6,690
pported. This will bypass checking PodDisruptionBudgets, use with caution. --dry-run string[="unchanged"]     Default: "none" Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. --force Continue even if there are pods that do not declare a controller. --grace-period int     Default: -1 Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used. -h, --hel
6,691
help for drain --ignore-daemonsets Ignore DaemonSet-managed pods. --pod-selector string Label selector to filter pods on the node -l, --selector string Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints. --skip-wait-for-delete-timeout int If pod DeletionTimestamp older than N seconds, skip waiting for the pod. Seconds must be greater than 0 to skip. --timeout duration The length of time to wait before giving up, zero means infinite --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. --azure-container-registry-config string Path to the file containing Azure container registry configuration information. --cache-dir string     Default: "$HO
6,692
ME/.kube/cache" Default cache directory --certificate-authority string Path to a cert file for the certificate authority --client-certificate strin
6,693
Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cloud-provider-gce-l7lb-src-cidrs cidrs     Default: 130.211.0.0/22,35.191.0.0/16 CIDRs 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/16 CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks --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-c
6,694
ompression 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 strin
6,695
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-pass
6,696
word 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
6,697
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 See Also kubectl - kubectl controls the Kubernetes cluster manager kubectl edit Synopsis Edit a resource from the default editor. The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows. When attempting to open
6,698
the editor, it will first attempt to use the shell that has been defined in the 'SHELL' environment variable. If this is not defined, the default shell will be used, which is '/bin/bash' for Linux or 'cmd' for Windows. You can edit multiple objects, although changes are applied one at a time. The command accepts file names as well as command-line arguments, although the files you point to must be previously saved versions of resources.
6,699