text
stringlengths 1
1k
| id
int64 0
8.58k
|
---|---|
--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
--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
repor | 7,000 |
ted version
--warnings-as-errors
Treat warnings received from the server as errors and exit with a non-zero exit cod | 7,001 |
See Also
kubectl set - Set specific features on objects
kubectl taint
Synopsis
Update the taints on one or more nodes.
A taint consists of a key, value, and effect. As an argument here, it is expressed as
key=value:effect.
The key must begin with a letter or number, and may contain letters, numbers, hyphens,
dots, and underscores, up to 253 characters.
Optionally, the key can begin with a DNS subdomain prefix and a single '/', like
example.com/my-app.
The value is optional. If given, it must begin with a letter or number, and may contain
letters, numbers, hyphens, dots, and underscores, up to 63 characters.
The effect must be NoSchedule, PreferNoSchedule or NoExecute.
Currently taint can only apply to node.
kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ...
KEY_N=VAL_N:TAINT_EFFECT_N
Examples
# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect
'NoSchedule'
# If a taint with that key and effect already exists, its value is replaced as spe | 7,002 |
cified
kubectl taint nodes foo dedicated=special-user:NoSchedule
# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists
kubectl taint nodes foo dedicated:NoSchedule-
# Remove from node 'foo' all the taints with key 'dedicated'
kubectl taint nodes foo dedicated-
# Add a taint with key 'dedicated' on nodes having label myLabel=X
kubectl taint node -l myLabel=X dedicated=foo:PreferNoSchedule
# Add to node 'foo' a taint with key 'bar' and no value
kubectl taint nodes foo bar:NoSchedule
Options
--all
Select all nodes in the cluster•
•
•
•
•
•
| 7,003 |
--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-taint"
Name of the manager used to track field ownership.
-h, --help
help for taint
-o, --output string
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile,
jsonpath, jsonpath-as-json, jsonpath-file).
--overwrite
If true, allow taints to be overwritten, otherwise reject taint updates that overwrite existing
taints.
-l, --selector string
Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2).
Matching objects must satis | 7,004 |
fy all of the specified label constraints.
--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/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 | 7,005 |
"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 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 De | 7,006 |
fault:
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 strin | 7,007 |
The name of the kubeconfig context to use
--default-not-ready-toleration-seconds int Default: 300
Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by
default to every pod that does not already have such a toleration.
--default-unreachable-toleration-seconds int Default: 300
Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by
default to every pod that does not already have such a toleration.
--disable-compression
If true, opt-out of response compression for all requests to the server
--insecure-skip-tls-verify
If true, the server's certificate will not be checked for validity. This will make your HTTPS
connections insecure
--kubeconfig string
Path to the kubeconfig file to use for CLI requests.
--match-server-version
Require server version to match client version
-n, --namespace string
If present, the namespace scope for this CLI request
--password string
Password for basic authentication to the API s | 7,008 |
erver
--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 | 7,009 |
-s, --server string
The address and port of the Kubernetes API server
--storage-driver-buffer-duration duration Default: 1m0s
Writes in the storage driver will be buffered for this duration, and committed to the non
memory backends as a single transaction
--storage-driver-db string Default: "cadvisor"
database name
--storage-driver-host string Default: "localhost:8086"
database host:port
--storage-driver-password string Default: "root"
database password
--storage-driver-secure
use secure connection with database
--storage-driver-table string Default: "stats"
table name
--storage-driver-user string Default: "root"
database username
--tls-server-name string
Server name to use for server certificate validation. If it is not provided, the hostname used to
contact the server is used
--token string
Bearer token for authentication to the API server
--user string
The name of the kubeconfig user to use
--username string
Username for basic authentication to the API server | 7,010 |
--version version[=true | 7,011 |
--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 top
Synopsis
Display resource (CPU/memory) usage.
The top command allows you to see the resource consumption for nodes or pods.
This command requires Metrics Server to be correctly configured and working on the server.
kubectl top [flags]
Options
-h, --help
help for top
--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.• | 7,012 |
--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 already have such a toleration.
--default-unreachable-toleration-seconds int | 7,013 |
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 insecur | 7,014 |
--kubeconfig string
Path to the kubeconfig file to use for CLI requests.
--match-server-version
Require server version to match client version
-n, --namespace string
If present, the namespace scope for this CLI request
--password string
Password for basic authentication to the API server
--profile string Default: "none"
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
--profile-output string Default: "profile.pprof"
Name of the file to write the profile to
--request-timeout string Default: "0"
The length of time to wait before giving up on a single server request. Non-zero values should
contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout
requests.
-s, --server string
The address and port of the Kubernetes API server
--storage-driver-buffer-duration duration Default: 1m0s
Writes in the storage driver will be buffered for this duration, and committed to the non
memory backends as a single transactio | 7,015 |
n
--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-secur | 7,016 |
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
kubectl top node - Display resource (CPU/memory) usage of nodes
kubectl top pod - Display resource (CPU/memory) usage of pods
kubectl top node
Synopsis
Display resource (CPU/memory) usage | 7,017 |
of nodes.•
•
| 7,018 |
The top-node command allows you to see the resource consumption of nodes.
kubectl top node [NAME | -l label]
Examples
# Show metrics for all nodes
kubectl top node
# Show metrics for a given node
kubectl top node NODE_NAME
Options
-h, --help
help for node
--no-headers
If present, print output without headers
-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-capacity
Print node resources based on Capacity instead of Allocatable(default) of the nodes.
--sort-by string
If non-empty, sort nodes list using specified field. The field can be either 'cpu' or 'memory'.
--use-protocol-buffers Default: true
Enables using protocol-buffers to access Metrics API.
--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 operatio | 7,019 |
n, this flag can be repeated to specify multiple groups.
--as-uid strin | 7,020 |
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 | 7,021 |
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 | 7,022 |
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 | 7,023 |
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 | 7,024 |
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 top - Display resource (CPU/memory) usage • | 7,025 |
kubectl top pod
Synopsis
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
kubectl top pod [NAME | -l label]
Examples
# Show metrics for all pods in the default namespace
kubectl top pod
# Show metrics for all pods in the given namespace
kubectl top pod --namespace=NAMESPACE
# Show metrics for a given pod and its containers
kubectl top pod POD_NAME --containers
# Show metrics for the pods defined by label name=myLabel
kubectl top pod -l name=myLabel
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.
--containers
If present, print usage of containers within a pod.
--field-selector string
Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector
key1=val | 7,026 |
ue1,key2=value2). The server only supports a limited number of field queries per
type.
-h, --help
help for pod
--no-header | 7,027 |
If present, print output without headers.
-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.
--sort-by string
If non-empty, sort pods list using specified field. The field can be either 'cpu' or 'memory'.
--sum
Print the sum of the resource usage
--use-protocol-buffers Default: true
Enables using protocol-buffers to access Metrics API.
--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
| 7,028 |
Path to a cert file for the certificate authority
--client-certificate string
Path to a client certificate file for TLS
--client-key strin | 7,029 |
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 | 7,030 |
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 | 7,031 |
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 | 7,032 |
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 | 7,033 |
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 top - Display resource (CPU/memory) usage
kubectl uncordon
Synopsis
Mark node as schedulable.
kubectl uncordon NODE
Examples
# Mark node "foo" as schedulable
kubectl uncordon foo
Options
--dry-run string[="unchanged"] Default: "none"• | 7,034 |
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.
-h, --help
help for uncordon
-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.
--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-ce | 7,035 |
rtificate 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 check | 7,036 |
--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. This will make your HTTPS
connections insecure
--kubeconfig string
Path | 7,037 |
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 | 7,038 |
--profile-output string Default: "profile.pprof"
Name of the file to write the profile to
--request-timeout string Default: "0"
The length of time to wait before giving up on a single server request. Non-zero values should
contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout
requests.
-s, --server string
The address and port of the Kubernetes API server
--storage-driver-buffer-duration duration Default: 1m0s
Writes in the storage driver will be buffered for this duration, and committed to the non
memory backends as a single transaction
--storage-driver-db string Default: "cadvisor"
database name
--storage-driver-host string Default: "localhost:8086"
database host:port
--storage-driver-password string Default: "root"
database password
--storage-driver-secure
use secure connection with database
--storage-driver-table string Default: "stats"
table name
--storage-driver-user string Default: "root"
database username
--tls-s | 7,039 |
erver-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 serve | 7,040 |
--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 version
Synopsis
Print the client and server version information for the current context.
kubectl version [flags]
Examples
# Print the client and server versions for the current context
kubectl version
Options
--client
If true, shows client version only (no server required).
-h, --help
help for version
-o, --output string• | 7,041 |
One of 'yaml' or 'json'.
--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 GC | 7,042 |
E firewall for L4 LB traffic proxy & health checks
--cluster string
The name of the kubeconfig cluster to use
--context strin | 7,043 |
The name of the kubeconfig context to use
--default-not-ready-toleration-seconds int Default: 300
Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by
default to every pod that does not already have such a toleration.
--default-unreachable-toleration-seconds int Default: 300
Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by
default to every pod that does not already have such a toleration.
--disable-compression
If true, opt-out of response compression for all requests to the server
--insecure-skip-tls-verify
If true, the server's certificate will not be checked for validity. This will make your HTTPS
connections insecure
--kubeconfig string
Path to the kubeconfig file to use for CLI requests.
--match-server-version
Require server version to match client version
-n, --namespace string
If present, the namespace scope for this CLI request
--password string
Password for basic authentication to the API s | 7,044 |
erver
--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 | 7,045 |
-s, --server string
The address and port of the Kubernetes API server
--storage-driver-buffer-duration duration Default: 1m0s
Writes in the storage driver will be buffered for this duration, and committed to the non
memory backends as a single transaction
--storage-driver-db string Default: "cadvisor"
database name
--storage-driver-host string Default: "localhost:8086"
database host:port
--storage-driver-password string Default: "root"
database password
--storage-driver-secure
use secure connection with database
--storage-driver-table string Default: "stats"
table name
--storage-driver-user string Default: "root"
database username
--tls-server-name string
Server name to use for server certificate validation. If it is not provided, the hostname used to
contact the server is used
--token string
Bearer token for authentication to the API server
--user string
The name of the kubeconfig user to use
--username string
Username for basic authentication to the API server | 7,046 |
--version version[=true | 7,047 |
--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 wait
Synopsis
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the
Status field of every given resource.
Alternatively, the command can wait for the given set of resources to be deleted by providing
the "delete" keyword as the value to the --for flag.
A successful message will be printed to stdout indicating when the specified condition has been
met. You can use -o option to change to output destination.
kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)])
[--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]
Examples
# Wait for th | 7,048 |
e pod "busybox1" to contain the status condition of type "Ready"
kubectl wait --for=condition=Ready pod/busybox1
# The default value of status condition is true; you can wait for other targets after an equal
delimiter (compared after Unicode simple case folding, which is a more general form of case-
insensitivity)
kubectl wait --for=condition=Ready=false pod/busybox1
# Wait for the pod "busybox1" to contain the status phase to be "Running"
kubectl wait --for=jsonpath='{.status.phase}'=Running pod/busybox1
# Wait for pod "busybox1" to be Ready
kubectl wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/
busybox1
# Wait for the service "loadbalancer" to have ingress.
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' service/loadbalancer | 7,049 |
# Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the
"delete" command
kubectl delete pod/busybox1
kubectl wait --for=delete pod/busybox1 --timeout=60s
Options
--all
Select 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.
--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.
--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
identifying the resource.
--for string
The condition to wait on: [delete|condition=condition-name[=condition-value]|
jsonpath='{JSONPath | 7,050 |
expression}'=[JSONPath value]]. The default condition-value is true.
Condition values are compared after Unicode simple case folding, which is a more general
form of case-insensitivity.
-h, --help
help for wait
--local
If true, annotation will NOT contact api-server but run locally.
-o, --output strin | 7,051 |
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile,
jsonpath, jsonpath-as-json, jsonpath-file).
-R, --recursive Default: true
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)
--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/text/template/#pkg-overview].
--timeout duration Default: 30s
The length of time to wait before giving up. Zero means check once and don't wait, negative
means wait for a week.
--as string
Username to impersonate for the operation. User could be a regular user or a service account
in | 7,052 |
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 strin | 7,053 |
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
| 7,054 |
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 | 7,055 |
Require server version to match client version
-n, --namespace string
If present, the namespace scope for this CLI request
--password string
Password for basic authentication to the API server
--profile string Default: "none"
Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
--profile-output string Default: "profile.pprof"
Name of the file to write the profile to
--request-timeout string Default: "0"
The length of time to wait before giving up on a single server request. Non-zero values should
contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout
requests.
-s, --server string
The address and port of the Kubernetes API server
--storage-driver-buffer-duration duration Default: 1m0s
Writes in the storage driver will be buffered for this duration, and committed to the non
memory backends as a single transaction
--storage-driver-db string Default: "cadvisor"
database name
--storage-driver-host string | 7,056 |
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 | 7,057 |
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
Synopsis
kubectl controls the Kubernetes cluster manager.
Find more information in Command line tool (kubectl ).
kubectl [flags ]• | 7,058 |
Options
--add-dir-header
If true, adds the file directory to the header of the log messages
--alsologtostderr
log to standard error as well as files
--as string
Username to impersonate for the operation
--as-group stringArray
Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--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 opene | 7,059 |
d 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.
-h, --help
help for kubectl
--insecure-skip-tls-verify
If true, the server's certificate will not be checked for validity. This will make your HTTPS
connections insecure
--kubeconfig string
Path to the kubeconfig file to use for CLI requests.
--log-backtrace-at traceLocation Default: :0
when logging hits line file:N, emit a stack trace
--log-dir string
If non-empty, write log fi | 7,060 |
les in this director | 7,061 |
--log-file string
If non-empty, use this log file
--log-file-max-size uint Default: 1800
Defines 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: 5s
Maximum number of seconds between log flushes
--logtostderr Default: true
log to standard error instead of files
--match-server-version
Require server version to match client version
-n, --namespace string
If present, the namespace scope for this CLI request
--one-output
If true, only write logs to their native severity level (vs also writing to each lower severity
level)
--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 be | 7,062 |
fore 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
--skip-headers
If true, avoid header prefixes in the log messages
--skip-log-headers
If true, avoid headers when opening log files
--stderrthreshold severity Default: 2
logs at or above this threshold go to stderr
--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
-v, --v Level
number for the log level verbosity
--version version[=true | 7,063 |
Print version information and quit
--vmodule moduleSpec
comma-separated list of pattern=N settings for file-filtered logging
--warnings-as-errors
Treat warnings received from the server as errors and exit with a non-zero exit code
Environment variables
KUBECONFIG
Path to the kubectl configuration ("kubeconfig") file. Default: "$HOME/.kube/config"
KUBECTL_COMMAND_HEADERS
When set to false, turns off extra HTTP headers detailing invoked kubectl command
(Kubernetes version v1.22 or later)
KUBECTL_EXPLAIN_OPENAPIV3
Toggles whether calls to `kubectl explain` use the new OpenAPIv3 data source available.
OpenAPIV3 is enabled by default since Kubernetes 1.24.
KUBECTL_ENABLE_CMD_SHADOW
When 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_REMOTE_COMMAND_WEBSOCKETS
When set to true, the kubectl exec, cp, and attach commands will a | 7,064 |
ttempt to stream using the
websockets protocol. If the upgrade to websockets fails, the commands will fallback to use the
current SPDY protocol.
See Also
kubectl annotate - Update the annotations on a resource
kubectl api-resources - Print the supported API resources on the server
kubectl 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 stdin
kubectl attach - Attach to a running container
kubectl auth - Inspect authorization
kubectl autoscale - Auto-scale a Deployment, ReplicaSet, or ReplicationController
kubectl certificate - Modify certificate resources.
kubectl cluster-info - Display cluster info
kubectl completion - Output shell completion code for the specified shell (bash or zsh)
kubectl config - Modify kubeconfig files
kubectl cordon - Mark node as unschedulable
kubectl cp - Copy files and directories to and from containers.
kubectl create - Create a reso | 7,065 |
urce from a file or from stdin.
kubectl debug - Create debugging sessions for troubleshooting workloads and nodes
kubectl delete - Delete resources by filenames, stdin, resources and names, or by
resources and label selector
kubectl describe - Show details of a specific resource or group of resources
kubectl diff - Diff live version against would-be applied version
kubectl drain - Drain node in preparation for maintenance
kubectl edit - Edit a resource on the server•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
| 7,066 |
kubectl events - List events
kubectl exec - Execute a command in a container
kubectl explain - Documentation of resources
kubectl expose - Take a replication controller, service, deployment or pod and expose it as
a new Kubernetes Service
kubectl get - Display one or many resources
kubectl kustomize - Build a kustomization target from a directory or a remote url.
kubectl label - Update the labels on a resource
kubectl logs - Print the logs for a container in a pod
kubectl options - Print the list of flags inherited by all commands
kubectl patch - Update field(s) of a resource
kubectl plugin - Provides utilities for interacting with plugins.
kubectl port-forward - Forward one or more local ports to a pod
kubectl proxy - Run a proxy to the Kubernetes API server
kubectl replace - Replace a resource by filename or stdin
kubectl rollout - Manage the rollout of a resource
kubectl run - Run a particular image on the cluster
kubectl scale - Set a new size for a Deployment, Rep | 7,067 |
licaSet or Replication Controller
kubectl set - Set specific features on objects
kubectl taint - Update the taints on one or more nodes
kubectl top - Display Resource (CPU/Memory/Storage) usage.
kubectl uncordon - Mark node as schedulable
kubectl version - Print the client and server version information
kubectl wait - Experimental: Wait for a specific condition on one or many resources.
JSONPath Support
Kubectl supports JSONPath template.
JSONPath template is composed of JSONPath expressions enclosed by curly braces {}. Kubectl
uses JSONPath expressions to filter on specific fields in the JSON object and format the output.
In addition to the original JSONPath template syntax, the following functions and syntax are
valid:
Use double quotes to quote text inside JSONPath expressions.
Use the range , end operators to iterate lists.
Use negative slice indices to step backwards through a list. Negative indices do not "wrap
around" a list and are valid as long as -index + listLength >= | 7,068 |
0 .
Note:
The $ operator is optional since the expression always starts from the root object by
default.
The result object is printed as its String() function.
Given the JSON input:
{
"kind" : "List" ,
"items" :[
{•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
1.
2.
3.
•
| 7,069 |
"kind" :"None" ,
"metadata" :{
"name" :"127.0.0.1" ,
"labels" :{
"kubernetes.io/hostname" :"127.0.0.1"
}
},
"status" :{
"capacity" :{"cpu" :"4"},
"addresses" :[{"type" : "LegacyHostIP" , "address" :"127.0.0.1" }]
}
},
{
"kind" :"None" ,
"metadata" :{"name" :"127.0.0.2" },
"status" :{
"capacity" :{"cpu" :"8"},
"addresses" :[
{ "type" : "LegacyHostIP" , "address" :"127.0.0.2" },
{ "type" : "another" , "address" :"127.0.0.3" }
]
}
}
],
"users" :[
{
"name" : "myself" ,
"user" : {}
},
{
"name" : "e2e" ,
"user" : {"username" : "admin" , "password" : "secret" }
}
]
}
Function Description Example Result
text the plain text kind is {.kind} kind is List
@the current
object{@} the same as input
. or [] child operator {.kind} , {['kind']} or {['name\.type']} List
..recursive
descent{..name}127.0.0.1 | 7,070 |
127.0.0.2
myself e2e
*wildcard. Get
all objects{.items[*].metadata.name}[127.0.0.1
127.0.0.2]
[start:end:step]subscript
operator{.users[0].name} myself
[,] union operator {.items[*]['metadata.name', 'status.capacity']}127.0.0.1 127.0.0.2
map[cpu:4]
map[cpu:8]
?() filter {.users[?(@.name=="e2e")].user.password} secre | 7,071 |
Function Description Example Result
range , end iterate list{range .items[*]}[{.metadata.name},
{.status.capacity}] {end}[127.0.0.1,
map[cpu:4]]
[127.0.0.2,
map[cpu:8]]
''quote
interpreted
string{range .items[*]}{.metadata.name}{'\t'}{end} 127.0.0.1 127.0.0.2
\escape
termination
character{.items[0].metadata.labels.kubernetes\.io/
hostname}127.0.0.1
Examples using kubectl and JSONPath expressions:
kubectl get pods -o json
kubectl get pods -o =jsonpath ='{@}'
kubectl get pods -o =jsonpath ='{.items[0]}'
kubectl get pods -o =jsonpath ='{.items[0].metadata.name}'
kubectl get pods -o =jsonpath ="{.items[*]['metadata.name', 'status.capacity']}"
kubectl get pods -o =jsonpath ='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}
{end}'
kubectl get pods -o =jsonpath ='{.items[0].metadata.labels.kubernetes\.io/hostname}'
Note:
On Windows, you must double quote any JSONPath template that contains spaces (not single
quote as shown above for bash). This in turn means that you mus | 7,072 |
t use a single quote or escaped
double quote around any literals in the template. For example:
kubectl get pods -o=jsonpath= "{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}
{end}"
kubectl get pods -o=jsonpath= "{range .items[*]}{.metadata.name}{\" \t\"}{.status.startTime}{\" \n\"}
{end}"
Note:
JSONPath regular expressions are not supported. If you want to match using regular
expressions, you can use a tool such as jq.
# kubectl does not support regular expressions for JSONpath output
# The following command does not work
kubectl get pods -o jsonpath ='{.items[?(@.metadata.name=~/^test$/)].metadata.name}'
# The following command achieves the desired result
kubectl get pods -o json | jq -r '.items[] | select(.metadata.name | test("test-")).metadata.name'
kubectl for Docker Users
You can use the Kubernetes command line tool kubectl to interact with the API Server. Using
kubectl is straightforward if you are familiar with the Docker command line tool. However,
there are | 7,073 |
a few differences between the Docker commands and the kubectl commands. The
following sections show a Docker sub-command and describe the equivalent kubectl command | 7,074 |
docker run
To run an nginx Deployment and expose the Deployment, see kubectl create deployment .
docker:
docker run -d --restart =always -e DOMAIN =cluster --name nginx-app -p 80:80 nginx
55c103fa129692154a7652490236fee9be47d70a8dd562281ae7d2f9a339a6db
docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
55c103fa1296 nginx "nginx -g 'daemon of..." 9 seconds ago Up 9 seconds
0.0.0.0:80->80/tcp nginx-app
kubectl:
# start the pod running nginx
kubectl create deployment --image =nginx nginx-app
deployment.apps/nginx-app created
# add env to nginx-app
kubectl set env deployment/nginx-app DOMAIN =cluster
deployment.apps/nginx-app env updated
Note: kubectl commands print the type and name of the resource created or mutated, which
can then be used in subsequent commands. You can expose a new Service after a Deployment is
created.
# expose a port through with a ser | 7,075 |
vice
kubectl expose deployment nginx-app --port =80 --name =nginx-http
service "nginx-http" exposed
By using kubectl, you can create a Deployment to ensure that N pods are running nginx, where
N is the number of replicas stated in the spec and defaults to 1. You can also create a service
with a selector that matches the pod labels. For more information, see Use a Service to Access
an Application in a Cluster .
By default images run in the background, similar to docker run -d ... . To run things in the
foreground, use kubectl run to create pod:
kubectl run [-i] [--tty] --attach <name> --image =<image>
Unlike docker run ... , if you specify --attach , then you attach stdin , stdout and stderr . You
cannot control which streams are attached ( docker -a ... ). To detach from the container, you can
type the escape sequence Ctrl+P followed by Ctrl+Q.
docker ps
To list what is currently running, see kubectl get | 7,076 |
docker:
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
14636241935f ubuntu:16.04 "echo test" 5 seconds ago Exited (0) 5 seconds
ago cocky_fermi
55c103fa1296 nginx "nginx -g 'daemon of..." About a minute ago Up About a
minute 0.0.0.0:80->80/tcp nginx-app
kubectl:
kubectl get po
NAME READY STATUS RESTARTS AGE
nginx-app-8df569cb7-4gd89 1/1 Running 0 3m
ubuntu 0/1 Completed 0 20s
docker attach
To attach a process that is already running in a container, see kubectl attach .
docker:
docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
55c103fa1296 nginx "nginx -g 'daemon of..." 5 minutes ago | 7,077 |
Up 5 minutes
0.0.0.0:80->80/tcp nginx-app
docker attach 55c103fa1296
...
kubectl:
kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-app-5jyvm 1/1 Running 0 10m
kubectl attach -it nginx-app-5jyvm
...
To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.
docker exec
To execute a command in a container, see kubectl exec .
docker | 7,078 |
docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
55c103fa1296 nginx "nginx -g 'daemon of..." 6 minutes ago Up 6 minutes
0.0.0.0:80->80/tcp nginx-app
docker exec 55c103fa1296 cat /etc/hostname
55c103fa1296
kubectl:
kubectl get po
NAME READY STATUS RESTARTS AGE
nginx-app-5jyvm 1/1 Running 0 10m
kubectl exec nginx-app-5jyvm -- cat /etc/hostname
nginx-app-5jyvm
To use interactive commands.
docker:
docker exec -ti 55c103fa1296 /bin/sh
# exit
kubectl:
kubectl exec -ti nginx-app-5jyvm -- /bin/sh
# exit
For more information, see Get a Shell to a Running Container .
docker logs
To follow stdout/stderr of a process that is running, see kubectl logs .
docker:
docker logs -f a9e
192.168.9.1 - - [14/Jul/2015:01:04:02 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.35.0" "-"
192.168.9.1 - - [14/Jul/2015:01:04:03 +0000] "GET / HTTP/1 | 7,079 |
.1" 200 612 "-" "curl/7.35.0" "-"
kubectl:
kubectl logs -f nginx-app-zibvs
10.240.63.110 - - [14/Jul/2015:01:09:01 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.26.0" "-"
10.240.63.110 - - [14/Jul/2015:01:09:02 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.26.0" "- | 7,080 |
There is a slight difference between pods and containers; by default pods do not terminate if
their processes exit. Instead the pods restart the process. This is similar to the docker run option
--restart=always with one major difference. In docker, the output for each invocation of the
process is concatenated, but for Kubernetes, each invocation is separate. To see the output from
a previous run in Kubernetes, do this:
kubectl logs --previous nginx-app-zibvs
10.240.63.110 - - [14/Jul/2015:01:09:01 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.26.0" "-"
10.240.63.110 - - [14/Jul/2015:01:09:02 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.26.0" "-"
For more information, see Logging Architecture .
docker stop and docker rm
To stop and delete a running process, see kubectl delete .
docker:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS
PORTS NAMES
a9ec34d98787 nginx "nginx -g 'daem | 7,081 |
on of" 22 hours ago Up 22 hours
0.0.0.0:80->80/tcp, 443/tcp nginx-app
docker stop a9ec34d98787
a9ec34d98787
docker rm a9ec34d98787
a9ec34d98787
kubectl:
kubectl get deployment nginx-app
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-app 1/1 1 1 2m
kubectl get po -l app=nginx-app
NAME READY STATUS RESTARTS AGE
nginx-app-2883164633-aklf7 1/1 Running 0 2m
kubectl delete deployment nginx-app
deployment "nginx-app" deleted
kubectl get po -l app=nginx-app
# Return nothin | 7,082 |
Note: When you use kubectl, you don't delete the pod directly. You have to first delete the
Deployment that owns the pod. If you delete the pod directly, the Deployment recreates the
pod.
docker login
There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes
with a private registry, see Using a Private Registry .
docker version
To get the version of client and server, see kubectl version .
docker:
docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): linux/amd64
Server version: 1.7.0
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 0baf609
OS/Arch (server): linux/amd64
kubectl:
kubectl version
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.9+a3d1dfa6f4335",
GitCommit:"9b77fed11a9843ce3780f70dd251e92901c43072", GitTreeState:"dirty",
BuildDate:"2017-08-29T20:32:58Z", OpenPaasKubernetesVersion:"v1.03.02", GoVersion:"go | 7,083 |
1.7.5",
Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.9+a3d1dfa6f4335",
GitCommit:"9b77fed11a9843ce3780f70dd251e92901c43072", GitTreeState:"dirty",
BuildDate:"2017-08-29T20:32:58Z", OpenPaasKubernetesVersion:"v1.03.02", GoVersion:"go1.7.5",
Compiler:"gc", Platform:"linux/amd64"}
docker info
To get miscellaneous information about the environment and configuration, see kubectl cluster-
info.
docker:
docker info
Containers: 40
Images: 16 | 7,084 |
Storage Driver: aufs
Root Dir: /usr/local/google/docker/aufs
Backing Filesystem: extfs
Dirs: 248
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-53-generic
Operating System: Ubuntu 14.04.2 LTS
CPUs: 12
Total Memory: 31.32 GiB
Name: k8s-is-fun.mtv.corp.google.com
ID: ADUV:GCYR:B3VJ:HMPO:LNPQ:KD5S:YKFQ:76VN:IANZ:7TFV:ZBF4:BYJO
WARNING: No swap limit support
kubectl:
kubectl cluster-info
Kubernetes master is running at https://203.0.113.141
KubeDNS is running at https://203.0.113.141/api/v1/namespaces/kube-system/services/kube-
dns/proxy
kubernetes-dashboard is running at https://203.0.113.141/api/v1/namespaces/kube-system/
services/kubernetes-dashboard/proxy
Grafana is running at https://203.0.113.141/api/v1/namespaces/kube-system/services/
monitoring-grafana/proxy
Heapster is running at https://203.0.113.141/api/v1/namespaces/kube-system/services/
monitoring-heapster/proxy
InfluxDB is running at https://203.0.113.141/api/v1/nam | 7,085 |
espaces/kube-system/services/
monitoring-influxdb/proxy
kubectl Usage Conventions
Recommended usage conventions for kubectl .
Using kubectl in Reusable Scripts
For a stable output in a script:
Request one of the machine-oriented output forms, such as -o name , -o json , -o yaml , -o
go-template , or -o jsonpath .
Fully-qualify the version. For example, jobs.v1.batch/myjob . This will ensure that kubectl
does not use its default version that can change over time.
Don't rely on context, preferences, or other implicit states.•
•
| 7,086 |
Subresources
You can use the --subresource beta flag for kubectl commands like get, patch , edit and
replace to fetch and update subresources for all resources that support them. Currently,
only the status and scale subresources are supported.
For kubectl edit , the scale subresource is not supported. If you use --subresource
with kubectl edit and specify scale as the subresource, the command will error out.
The API contract against a subresource is identical to a full resource. While updating the
status subresource to a new value, keep in mind that the subresource could be potentially
reconciled by a controller to a different value.
Best Practices
kubectl run
For kubectl run to satisfy infrastructure as code:
Tag the image with a version-specific tag and don't move that tag to a new version. For
example, use :v1234 , v1.2.3 , r03062016-1-4 , rather than :latest (For more information, see
Best Practices for Configuration ).
Check in the script for an image that is heavily | 7,087 |
parameterized.
Switch to configuration files checked into source control for features that are needed, but
not expressible via kubectl run flags.
You can use the --dry-run=client flag to preview the object that would be sent to your cluster,
without really submitting it.
kubectl apply
You can use kubectl apply to create or update resources. For more information about
using kubectl apply to update resources, see Kubectl Book .
Component tools
Feature Gates
Feature Gates (removed)
kubelet
kube-apiserver
kube-controller-manager
kube-proxy
kube-scheduler•
◦
•
•
•
•
| 7,088 |
Feature Gates
This page contains an overview of the various feature gates an administrator can specify on
different Kubernetes components.
See feature stages for an explanation of the stages for a feature.
Overview
Feature gates are a set of key=value pairs that describe Kubernetes features. You can turn these
features on or off using the --feature-gates command line flag on each Kubernetes component.
Each Kubernetes component lets you enable or disable a set of feature gates that are relevant to
that component. Use -h flag to see a full set of feature gates for all components. To set feature
gates for a component, such as kubelet, use the --feature-gates flag assigned to a list of feature
pairs:
--feature-gates =...,GracefulNodeShutdown =true
The following tables are a summary of the feature gates that you can set on different
Kubernetes components.
The "Since" column contains the Kubernetes release when a feature is introduced or its
release stage is changed.
The "Until" column, i | 7,089 |
f not empty, contains the last Kubernetes release in which you can
still use a feature gate.
If a feature is in the Alpha or Beta state, you can find the feature listed in the Alpha/Beta
feature gate table .
If a feature is stable you can find all stages for that feature listed in the Graduated/
Deprecated feature gate table .
The Graduated/Deprecated feature gate table also lists deprecated and withdrawn
features.
Note: For a reference to old feature gates that are removed, please refer to feature gates
removed .
Feature gates for Alpha or Beta features
Feature gates for features in Alpha or Beta states
Feature Default Stage Since Until
AdmissionWebhookMatchConditions false Alpha 1.27 1.27
AdmissionWebhookMatchConditions true Beta 1.28 –
AggregatedDiscoveryEndpoint false Alpha 1.26 1.26
AggregatedDiscoveryEndpoint true Beta 1.27 –
AnyVolumeDataSource false Alpha 1.18 1.23
AnyVolumeDataSource true Beta 1.24 –
APIResponseCompression false Alpha 1.7 1.15
APIResponseCompression true Bet | 7,090 |
a 1.16 –
APIServerIdentity false Alpha 1.20 1.25
APIServerIdentity true Beta 1.26 –•
•
•
•
| 7,091 |
Feature Default Stage Since Until
APIServerTracing false Alpha 1.22 1.26
APIServerTracing true Beta 1.27 –
AppArmor true Beta 1.4 –
CloudControllerManagerWebhook false Alpha 1.27 –
CloudDualStackNodeIPs false Alpha 1.27 1.28
CloudDualStackNodeIPs true Beta 1.29 –
ClusterTrustBundle false Alpha 1.27 –
ClusterTrustBundleProjection false Alpha 1.29 –
ComponentSLIs false Alpha 1.26 1.26
ComponentSLIs true Beta 1.27 –
ConsistentListFromCache false Alpha 1.28 –
ContainerCheckpoint false Alpha 1.25 –
ContextualLogging false Alpha 1.24 –
CPUManagerPolicyAlphaOptions false Alpha 1.23 –
CPUManagerPolicyBetaOptions true Beta 1.23 –
CPUManagerPolicyOptions false Alpha 1.22 1.22
CPUManagerPolicyOptions true Beta 1.23 –
CRDValidationRatcheting false Alpha 1.28 –
CronJobsScheduledAnnotation true Beta 1.28 –
CrossNamespaceVolumeDataSource false Alpha 1.26 –
CSIMigrationPortworx false Alpha 1.23 1.24
CSIMigrationPortworx false Beta 1.25 –
CSIVolumeHealth false Alpha 1.21 –
CustomCPUCFSQuotaPeriod false | 7,092 |
Alpha 1.12 –
DevicePluginCDIDevices false Alpha 1.28 1.28
DevicePluginCDIDevices true Beta 1.29 –
DisableCloudProviders false Alpha 1.22 1.28
DisableCloudProviders true Beta 1.29 –
DisableKubeletCloudCredentialProviders false Alpha 1.23 1.28
DisableKubeletCloudCredentialProviders true Beta 1.29 –
DisableNodeKubeProxyVersion false Alpha 1.29 –
DynamicResourceAllocation false Alpha 1.26 –
ElasticIndexedJob true Beta 1.27 –
EventedPLEG false Alpha 1.26 1.26
EventedPLEG false Beta 1.27 –
GracefulNodeShutdown false Alpha 1.20 1.20
GracefulNodeShutdown true Beta 1.21 –
GracefulNodeShutdownBasedOnPodPriority false Alpha 1.23 1.23
GracefulNodeShutdownBasedOnPodPriority true Beta 1.24 –
HonorPVReclaimPolicy false Alpha 1.23 –
HPAContainerMetrics false Alpha 1.20 1.26
HPAContainerMetrics true Beta 1.27 –
HPAScaleToZero false Alpha 1.16 –
ImageMaximumGCAge false Alpha 1.29 | 7,093 |
Feature Default Stage Since Until
InPlacePodVerticalScaling false Alpha 1.27 –
InTreePluginAWSUnregister false Alpha 1.21 –
InTreePluginAzureDiskUnregister false Alpha 1.21 –
InTreePluginAzureFileUnregister false Alpha 1.21 –
InTreePluginGCEUnregister false Alpha 1.21 –
InTreePluginOpenStackUnregister false Alpha 1.21 –
InTreePluginPortworxUnregister false Alpha 1.23 –
InTreePluginvSphereUnregister false Alpha 1.21 –
JobBackoffLimitPerIndex false Alpha 1.28 1.28
JobBackoffLimitPerIndex true Beta 1.29 –
JobPodFailurePolicy false Alpha 1.25 1.25
JobPodFailurePolicy true Beta 1.26 –
JobPodReplacementPolicy false Alpha 1.28 1.28
JobPodReplacementPolicy true Beta 1.29 –
KubeletCgroupDriverFromCRI false Alpha 1.28 –
KubeletInUserNamespace false Alpha 1.22 –
KubeletPodResourcesDynamicResources false Alpha 1.27 –
KubeletPodResourcesGet false Alpha 1.27 –
KubeletSeparateDiskGC false Alpha 1.29 –
KubeletTracing false Alpha 1.25 1.26
KubeletTracing true Beta 1.27 –
KubeProxyDrainingTerminatingNod | 7,094 |
es false Alpha 1.28 –
LegacyServiceAccountTokenCleanUp false Alpha 1.28 1.28
LegacyServiceAccountTokenCleanUp true Beta 1.29 –
LoadBalancerIPMode false Alpha 1.29 –
LocalStorageCapacityIsolationFSQuotaMonitoring false Alpha 1.15 –
LogarithmicScaleDown false Alpha 1.21 1.21
LogarithmicScaleDown true Beta 1.22 –
LoggingAlphaOptions false Alpha 1.24 –
LoggingBetaOptions true Beta 1.24 –
MatchLabelKeysInPodAffinity false Alpha 1.29 –
MatchLabelKeysInPodTopologySpread false Alpha 1.25 1.26
MatchLabelKeysInPodTopologySpread true Beta 1.27 –
MaxUnavailableStatefulSet false Alpha 1.24 –
MemoryManager false Alpha 1.21 1.21
MemoryManager true Beta 1.22 –
MemoryQoS false Alpha 1.22 –
MinDomainsInPodTopologySpread false Alpha 1.24 1.24
MinDomainsInPodTopologySpread false Beta 1.25 1.26
MinDomainsInPodTopologySpread true Beta 1.27 –
MultiCIDRServiceAllocator false Alpha 1.27 –
NewVolumeManagerReconstruction false Beta 1.27 1.27
NewVolumeManagerReconstruction true Beta 1.28 –
NFTablesProxyMode false | 7,095 |
Alpha 1.29 | 7,096 |
Feature Default Stage Since Until
NodeInclusionPolicyInPodTopologySpread false Alpha 1.25 1.25
NodeInclusionPolicyInPodTopologySpread true Beta 1.26 –
NodeLogQuery false Alpha 1.27 –
NodeSwap false Alpha 1.22 1.27
NodeSwap false Beta 1.28 –
OpenAPIEnums false Alpha 1.23 1.23
OpenAPIEnums true Beta 1.24 –
PDBUnhealthyPodEvictionPolicy false Alpha 1.26 1.26
PDBUnhealthyPodEvictionPolicy true Beta 1.27 –
PersistentVolumeLastPhaseTransitionTime false Alpha 1.28 1.28
PersistentVolumeLastPhaseTransitionTime true Beta 1.29 –
PodAndContainerStatsFromCRI false Alpha 1.23 –
PodDeletionCost false Alpha 1.21 1.21
PodDeletionCost true Beta 1.22 –
PodDisruptionConditions false Alpha 1.25 1.25
PodDisruptionConditions true Beta 1.26 –
PodHostIPs false Alpha 1.28 1.28
PodHostIPs true Beta 1.29 –
PodIndexLabel true Beta 1.28 –
PodLifecycleSleepAction false Alpha 1.29 –
PodReadyToStartContainersCondition false Alpha 1.28 1.28
PodReadyToStartContainersCondition true Beta 1.29 –
PodSchedulingReadiness fals | 7,097 |
e Alpha 1.26 1.26
PodSchedulingReadiness true Beta 1.27 –
ProcMountType false Alpha 1.12 –
QOSReserved false Alpha 1.11 –
RecoverVolumeExpansionFailure false Alpha 1.23 –
RotateKubeletServerCertificate false Alpha 1.7 1.11
RotateKubeletServerCertificate true Beta 1.12 –
RuntimeClassInImageCriApi false Alpha 1.29 –
SchedulerQueueingHints true Beta 1.28 1.28
SchedulerQueueingHints false Beta 1.29 –
SecurityContextDeny false Alpha 1.27 –
SELinuxMountReadWriteOncePod false Alpha 1.25 1.26
SELinuxMountReadWriteOncePod false Beta 1.27 1.27
SELinuxMountReadWriteOncePod true Beta 1.28 –
SeparateTaintEvictionController true Beta 1.29 –
ServiceAccountTokenJTI false Alpha 1.29 –
ServiceAccountTokenNodeBinding false Alpha 1.29 –
ServiceAccountTokenNodeBindingValidation false Alpha 1.29 –
ServiceAccountTokenPodNodeInfo false Alpha 1.29 –
SidecarContainers false Alpha 1.28 1.28
SidecarContainers true Beta 1.29 –
SizeMemoryBackedVolumes false Alpha 1.20 1.2 | 7,098 |
Feature Default Stage Since Until
SizeMemoryBackedVolumes true Beta 1.22 –
StableLoadBalancerNodeSet true Beta 1.27 –
StatefulSetAutoDeletePVC false Alpha 1.23 1.26
StatefulSetAutoDeletePVC true Beta 1.27 –
StatefulSetStartOrdinal false Alpha 1.26 1.26
StatefulSetStartOrdinal true Beta 1.27 –
StorageVersionAPI false Alpha 1.20 –
StorageVersionHash false Alpha 1.14 1.14
StorageVersionHash true Beta 1.15 –
StructuredAuthenticationConfiguration false Alpha 1.29 –
StructuredAuthorizationConfiguration false Alpha 1.29 –
TopologyAwareHints false Alpha 1.21 1.22
TopologyAwareHints false Beta 1.23 1.23
TopologyAwareHints true Beta 1.24 –
TopologyManagerPolicyAlphaOptions false Alpha 1.26 –
TopologyManagerPolicyBetaOptions false Beta 1.26 1.27
TopologyManagerPolicyBetaOptions true Beta 1.28 –
TopologyManagerPolicyOptions false Alpha 1.26 1.27
TopologyManagerPolicyOptions true Beta 1.28 –
TranslateStreamCloseWebsocketRequests false Alpha 1.29 –
UnauthenticatedHTTP2DOSMitigation false Beta 1.28 1 | 7,099 |