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

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

##

Copy files and directories to and from containers.

```
kubectl cp <file-spec-src> <file-spec-dest>
```

##

```
  # !!!Important Note!!!
  # Requires that the 'tar' binary is present in your container
  # image.  If 'tar' is not present, 'kubectl cp' will fail.
  #
  # For advanced use cases, such as symlinks, wildcard expansion or
  # file mode preservation, consider using 'kubectl exec'.

  # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
  tar cf - /tmp/foo | kubectl exec -i -n <some-namespace> <some-pod> -- tar xf - -C /tmp/bar

  # Copy /tmp/foo from a remote pod to /tmp/bar locally
  kubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar

  # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace
  kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir

  # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container
  kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>

  # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
  kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar

  # Copy /tmp/foo from a remote pod to /tmp/bar locally
  kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar
```

##

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

-c, --container string

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

-h, --help

help for cp

--no-preserve

The copied file/directory's ownership and permissions will not be preserved in the container

--retries int

Set number of retries to complete a copy operation from a container. Specify 0 to disable or any negative value for infinite retrying. The default is 0 (no retry).

##

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

--as string

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

--as-group strings

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

--as-uid string

UID to impersonate for the operation.

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

Default cache directory

--certificate-authority string

Path to a cert file for the certificate authority

--client-certificate string

Path to a client certificate file for TLS

--client-key string

Path to a client key file for TLS

--cluster string

The name of the kubeconfig cluster to use

--context string

The name of the kubeconfig context to use

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

Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.

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

Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.

--disable-compression

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

--insecure-skip-tls-verify

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

--kubeconfig string

Path to the kubeconfig file to use for CLI requests.

--match-server-version

Require server version to match client version

-n, --namespace string

If present, the namespace scope for this CLI request

--password string

Password for basic authentication to the API server

--profile string     Default: "none"

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

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

Name of the file to write the profile to

--request-timeout string     Default: "0"

The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.

-s, --server string

The address and port of the Kubernetes API server

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

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

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

database name

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

database host:port

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

database password

--storage-driver-secure

use secure connection with database

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

table name

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

database username

--tls-server-name string

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

--token string

Bearer token for authentication to the API server

--user string

The name of the kubeconfig user to use

--username string

Username for basic authentication to the API server

--version version[=true]

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

--warnings-as-errors

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

##

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

title  kubectl cp content type  tool reference weight  30 auto generated  true no list  true            The file is auto generated from the Go source code of the component using a generic  generator  https   github com kubernetes sigs reference docs    To learn how to generate the reference documentation  please read  Contributing to the reference documentation   docs contribute generate ref docs    To update the reference content  please follow the  Contributing upstream   docs contribute generate ref docs contribute upstream   guide  You can file document formatting bugs against the  reference docs  https   github com kubernetes sigs reference docs   project              Copy files and directories to and from containers       kubectl cp  file spec src   file spec dest                       Important Note        Requires that the  tar  binary is present in your container     image   If  tar  is not present   kubectl cp  will fail          For advanced use cases  such as symlinks  wildcard expansion or     file mode preservation  consider using  kubectl exec          Copy  tmp foo local file to  tmp bar in a remote pod in namespace  some namespace    tar cf    tmp foo   kubectl exec  i  n  some namespace   some pod     tar xf    C  tmp bar        Copy  tmp foo from a remote pod to  tmp bar locally   kubectl exec  n  some namespace   some pod     tar cf    tmp foo   tar xf    C  tmp bar        Copy  tmp foo dir local directory to  tmp bar dir in a remote pod in the default namespace   kubectl cp  tmp foo dir  some pod   tmp bar dir        Copy  tmp foo local file to  tmp bar in a remote pod in a specific container   kubectl cp  tmp foo  some pod   tmp bar  c  specific container         Copy  tmp foo local file to  tmp bar in a remote pod in namespace  some namespace    kubectl cp  tmp foo  some namespace   some pod   tmp bar        Copy  tmp foo from a remote pod to  tmp bar locally   kubectl cp  some namespace   some pod   tmp foo  tmp bar               table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2   c    container string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Container name  If omitted  use the kubectl kubernetes io default container annotation for selecting the container to be attached or the first container in the pod will be chosen  p   td    tr    tr   td colspan  2   h    help  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p help for cp  p   td    tr    tr   td colspan  2    no preserve  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The copied file directory s ownership and permissions will not be preserved in the container  p   td    tr    tr   td colspan  2    retries int  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Set number of retries to complete a copy operation from a container  Specify 0 to disable or any negative value for infinite retrying  The default is 0  no retry    p   td    tr     tbody    table              table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    as string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username to impersonate for the operation  User could be a regular user or a service account in a namespace   p   td    tr    tr   td colspan  2    as group strings  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Group to impersonate for the operation  this flag can be repeated to specify multiple groups   p   td    tr    tr   td colspan  2    as uid string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p UID to impersonate for the operation   p   td    tr    tr   td colspan  2    cache dir string nbsp  nbsp  nbsp  nbsp  nbsp Default    HOME  kube cache   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Default cache directory  p   td    tr    tr   td colspan  2    certificate authority string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a cert file for the certificate authority  p   td    tr    tr   td colspan  2    client certificate string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client certificate file for TLS  p   td    tr    tr   td colspan  2    client key string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client key file for TLS  p   td    tr    tr   td colspan  2    cluster string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig cluster to use  p   td    tr    tr   td colspan  2    context string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig context to use  p   td    tr    tr   td colspan  2    default not ready toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for notReady NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    default unreachable toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for unreachable NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    disable compression  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  opt out of response compression for all requests to the server  p   td    tr    tr   td colspan  2    insecure skip tls verify  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  the server s certificate will not be checked for validity  This will make your HTTPS connections insecure  p   td    tr    tr   td colspan  2    kubeconfig string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to the kubeconfig file to use for CLI requests   p   td    tr    tr   td colspan  2    match server version  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Require server version to match client version  p   td    tr    tr   td colspan  2   n    namespace string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  the namespace scope for this CLI request  p   td    tr    tr   td colspan  2    password string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Password for basic authentication to the API server  p   td    tr    tr   td colspan  2    profile string nbsp  nbsp  nbsp  nbsp  nbsp Default   none   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of profile to capture  One of  none cpu heap goroutine threadcreate block mutex   p   td    tr    tr   td colspan  2    profile output string nbsp  nbsp  nbsp  nbsp  nbsp Default   profile pprof   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of the file to write the profile to  p   td    tr    tr   td colspan  2    request timeout string nbsp  nbsp  nbsp  nbsp  nbsp Default   0   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The length of time to wait before giving up on a single server request  Non zero values should contain a corresponding time unit  e g  1s  2m  3h   A value of zero means don t timeout requests   p   td    tr    tr   td colspan  2   s    server string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The address and port of the Kubernetes API server  p   td    tr    tr   td colspan  2    storage driver buffer duration duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Writes in the storage driver will be buffered for this duration  and committed to the non memory backends as a single transaction  p   td    tr    tr   td colspan  2    storage driver db string nbsp  nbsp  nbsp  nbsp  nbsp Default   cadvisor   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database name  p   td    tr    tr   td colspan  2    storage driver host string nbsp  nbsp  nbsp  nbsp  nbsp Default   localhost 8086   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database host port  p   td    tr    tr   td colspan  2    storage driver password string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database password  p   td    tr    tr   td colspan  2    storage driver secure  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p use secure connection with database  p   td    tr    tr   td colspan  2    storage driver table string nbsp  nbsp  nbsp  nbsp  nbsp Default   stats   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p table name  p   td    tr    tr   td colspan  2    storage driver user string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database username  p   td    tr    tr   td colspan  2    tls server name string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Server name to use for server certificate validation  If it is not provided  the hostname used to contact the server is used  p   td    tr    tr   td colspan  2    token string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Bearer token for authentication to the API server  p   td    tr    tr   td colspan  2    user string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig user to use  p   td    tr    tr   td colspan  2    username string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username for basic authentication to the API server  p   td    tr    tr   td colspan  2    version version  true   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p   version    version raw prints version information and quits    version vX Y Z    sets the reported version  p   td    tr    tr   td colspan  2    warnings as errors  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Treat warnings received from the server as errors and exit with a non zero exit code  p   td    tr     tbody    table             kubectl     kubectl      kubectl controls the Kubernetes cluster manager


kubernetes reference title kubectl port forward nolist true contenttype tool reference weight 30 autogenerated true

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

##

Forward one or more local ports to a pod.

 Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.

 If there are multiple pods matching the criteria, a pod will be selected automatically. The forwarding session ends when the selected pod terminates, and a rerun of the command is needed to resume forwarding.

```
kubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]
```

##

```
  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
  kubectl port-forward pod/mypod 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
  kubectl port-forward deployment/mydeployment 5000 6000

  # Listen on port 8443 locally, forwarding to the targetPort of the service's port named "https" in a pod selected by the service
  kubectl port-forward service/myservice 8443:https

  # Listen on port 8888 locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod 8888:5000

  # Listen on port 8888 on all addresses, forwarding to 5000 in the pod
  kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000

  # Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod
  kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000

  # Listen on a random port locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod :5000
```

##

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

--address strings     Default: "localhost"

Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of these addresses are available to bind.

-h, --help

help for port-forward

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

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

##

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

--as string

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

--as-group strings

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

--as-uid string

UID to impersonate for the operation.

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

Default cache directory

--certificate-authority string

Path to a cert file for the certificate authority

--client-certificate string

Path to a client certificate file for TLS

--client-key string

Path to a client key file for TLS

--cluster string

The name of the kubeconfig cluster to use

--context string

The name of the kubeconfig context to use

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

Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.

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

Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.

--disable-compression

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

--insecure-skip-tls-verify

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

--kubeconfig string

Path to the kubeconfig file to use for CLI requests.

--match-server-version

Require server version to match client version

-n, --namespace string

If present, the namespace scope for this CLI request

--password string

Password for basic authentication to the API server

--profile string     Default: "none"

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

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

Name of the file to write the profile to

--request-timeout string     Default: "0"

The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.

-s, --server string

The address and port of the Kubernetes API server

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

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

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

database name

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

database host:port

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

database password

--storage-driver-secure

use secure connection with database

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

table name

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

database username

--tls-server-name string

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

--token string

Bearer token for authentication to the API server

--user string

The name of the kubeconfig user to use

--username string

Username for basic authentication to the API server

--version version[=true]

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

--warnings-as-errors

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

##

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

title  kubectl port forward content type  tool reference weight  30 auto generated  true no list  true            The file is auto generated from the Go source code of the component using a generic  generator  https   github com kubernetes sigs reference docs    To learn how to generate the reference documentation  please read  Contributing to the reference documentation   docs contribute generate ref docs    To update the reference content  please follow the  Contributing upstream   docs contribute generate ref docs contribute upstream   guide  You can file document formatting bugs against the  reference docs  https   github com kubernetes sigs reference docs   project              Forward one or more local ports to a pod    Use resource type name such as deployment mydeployment to select a pod  Resource type defaults to  pod  if omitted    If there are multiple pods matching the criteria  a pod will be selected automatically  The forwarding session ends when the selected pod terminates  and a rerun of the command is needed to resume forwarding       kubectl port forward TYPE NAME  options   LOCAL PORT  REMOTE PORT      LOCAL PORT N  REMOTE PORT N                    Listen on ports 5000 and 6000 locally  forwarding data to from ports 5000 and 6000 in the pod   kubectl port forward pod mypod 5000 6000        Listen on ports 5000 and 6000 locally  forwarding data to from ports 5000 and 6000 in a pod selected by the deployment   kubectl port forward deployment mydeployment 5000 6000        Listen on port 8443 locally  forwarding to the targetPort of the service s port named  https  in a pod selected by the service   kubectl port forward service myservice 8443 https        Listen on port 8888 locally  forwarding to 5000 in the pod   kubectl port forward pod mypod 8888 5000        Listen on port 8888 on all addresses  forwarding to 5000 in the pod   kubectl port forward   address 0 0 0 0 pod mypod 8888 5000        Listen on port 8888 on localhost and selected IP  forwarding to 5000 in the pod   kubectl port forward   address localhost 10 19 21 23 pod mypod 8888 5000        Listen on a random port locally  forwarding to 5000 in the pod   kubectl port forward pod mypod  5000               table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    address strings nbsp  nbsp  nbsp  nbsp  nbsp Default   localhost   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Addresses to listen on  comma separated   Only accepts IP addresses or localhost as a value  When localhost is supplied  kubectl will try to bind on both 127 0 0 1 and   1 and will fail if neither of these addresses are available to bind   p   td    tr    tr   td colspan  2   h    help  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p help for port forward  p   td    tr    tr   td colspan  2    pod running timeout duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The length of time  like 5s  2m  or 3h  higher than zero  to wait until at least one pod is running  p   td    tr     tbody    table              table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    as string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username to impersonate for the operation  User could be a regular user or a service account in a namespace   p   td    tr    tr   td colspan  2    as group strings  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Group to impersonate for the operation  this flag can be repeated to specify multiple groups   p   td    tr    tr   td colspan  2    as uid string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p UID to impersonate for the operation   p   td    tr    tr   td colspan  2    cache dir string nbsp  nbsp  nbsp  nbsp  nbsp Default    HOME  kube cache   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Default cache directory  p   td    tr    tr   td colspan  2    certificate authority string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a cert file for the certificate authority  p   td    tr    tr   td colspan  2    client certificate string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client certificate file for TLS  p   td    tr    tr   td colspan  2    client key string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client key file for TLS  p   td    tr    tr   td colspan  2    cluster string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig cluster to use  p   td    tr    tr   td colspan  2    context string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig context to use  p   td    tr    tr   td colspan  2    default not ready toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for notReady NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    default unreachable toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for unreachable NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    disable compression  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  opt out of response compression for all requests to the server  p   td    tr    tr   td colspan  2    insecure skip tls verify  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  the server s certificate will not be checked for validity  This will make your HTTPS connections insecure  p   td    tr    tr   td colspan  2    kubeconfig string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to the kubeconfig file to use for CLI requests   p   td    tr    tr   td colspan  2    match server version  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Require server version to match client version  p   td    tr    tr   td colspan  2   n    namespace string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  the namespace scope for this CLI request  p   td    tr    tr   td colspan  2    password string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Password for basic authentication to the API server  p   td    tr    tr   td colspan  2    profile string nbsp  nbsp  nbsp  nbsp  nbsp Default   none   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of profile to capture  One of  none cpu heap goroutine threadcreate block mutex   p   td    tr    tr   td colspan  2    profile output string nbsp  nbsp  nbsp  nbsp  nbsp Default   profile pprof   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of the file to write the profile to  p   td    tr    tr   td colspan  2    request timeout string nbsp  nbsp  nbsp  nbsp  nbsp Default   0   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The length of time to wait before giving up on a single server request  Non zero values should contain a corresponding time unit  e g  1s  2m  3h   A value of zero means don t timeout requests   p   td    tr    tr   td colspan  2   s    server string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The address and port of the Kubernetes API server  p   td    tr    tr   td colspan  2    storage driver buffer duration duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Writes in the storage driver will be buffered for this duration  and committed to the non memory backends as a single transaction  p   td    tr    tr   td colspan  2    storage driver db string nbsp  nbsp  nbsp  nbsp  nbsp Default   cadvisor   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database name  p   td    tr    tr   td colspan  2    storage driver host string nbsp  nbsp  nbsp  nbsp  nbsp Default   localhost 8086   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database host port  p   td    tr    tr   td colspan  2    storage driver password string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database password  p   td    tr    tr   td colspan  2    storage driver secure  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p use secure connection with database  p   td    tr    tr   td colspan  2    storage driver table string nbsp  nbsp  nbsp  nbsp  nbsp Default   stats   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p table name  p   td    tr    tr   td colspan  2    storage driver user string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database username  p   td    tr    tr   td colspan  2    tls server name string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Server name to use for server certificate validation  If it is not provided  the hostname used to contact the server is used  p   td    tr    tr   td colspan  2    token string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Bearer token for authentication to the API server  p   td    tr    tr   td colspan  2    user string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig user to use  p   td    tr    tr   td colspan  2    username string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username for basic authentication to the API server  p   td    tr    tr   td colspan  2    version version  true   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p   version    version raw prints version information and quits    version vX Y Z    sets the reported version  p   td    tr    tr   td colspan  2    warnings as errors  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Treat warnings received from the server as errors and exit with a non zero exit code  p   td    tr     tbody    table             kubectl     kubectl      kubectl controls the Kubernetes cluster manager


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

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

##

Replace a resource by file name or stdin.

 JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by

        $ kubectl get TYPE NAME -o yaml

```
kubectl replace -f FILENAME
```

##

```
  # Replace a pod using the data in pod.json
  kubectl replace -f ./pod.json

  # Replace a pod based on the JSON passed into stdin
  cat pod.json | kubectl replace -f -

  # Update a single-container pod's image version (tag) to v4
  kubectl get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -

  # Force replace, delete and then re-create the resource
  kubectl replace --force -f ./pod.json
```

##

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

--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.

--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-manager string     Default: "kubectl-replace"

Name of the manager used to track field ownership.

-f, --filename strings

The files that contain the configurations to replace.

--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 replace

-k, --kustomize string

Process a kustomization directory. This flag can't be used together with -f or -R.

-o, --output string

Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).

--raw string

Raw URI to PUT 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.

--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.

--subresource string

If specified, replace will operate on the subresource of the requested object. Must be one of [status scale]. This flag is beta and may change in the future.

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

The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object

--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.

--wait

If true, wait for resources to be gone before returning. This waits for finalizers.

##

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

--as string

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

--as-group strings

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

--as-uid string

UID to impersonate for the operation.

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

Default cache directory

--certificate-authority string

Path to a cert file for the certificate authority

--client-certificate string

Path to a client certificate file for TLS

--client-key string

Path to a client key file for TLS

--cluster string

The name of the kubeconfig cluster to use

--context string

The name of the kubeconfig context to use

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

Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.

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

Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.

--disable-compression

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

--insecure-skip-tls-verify

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

--kubeconfig string

Path to the kubeconfig file to use for CLI requests.

--match-server-version

Require server version to match client version

-n, --namespace string

If present, the namespace scope for this CLI request

--password string

Password for basic authentication to the API server

--profile string     Default: "none"

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

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

Name of the file to write the profile to

--request-timeout string     Default: "0"

The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.

-s, --server string

The address and port of the Kubernetes API server

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

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

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

database name

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

database host:port

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

database password

--storage-driver-secure

use secure connection with database

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

table name

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

database username

--tls-server-name string

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

--token string

Bearer token for authentication to the API server

--user string

The name of the kubeconfig user to use

--username string

Username for basic authentication to the API server

--version version[=true]

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

--warnings-as-errors

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

##

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

title  kubectl replace content type  tool reference weight  30 auto generated  true no list  true            The file is auto generated from the Go source code of the component using a generic  generator  https   github com kubernetes sigs reference docs    To learn how to generate the reference documentation  please read  Contributing to the reference documentation   docs contribute generate ref docs    To update the reference content  please follow the  Contributing upstream   docs contribute generate ref docs contribute upstream   guide  You can file document formatting bugs against the  reference docs  https   github com kubernetes sigs reference docs   project              Replace a resource by file name or stdin    JSON and YAML formats are accepted  If replacing an existing resource  the complete resource spec must be provided  This can be obtained by            kubectl get TYPE NAME  o yaml      kubectl replace  f FILENAME                   Replace a pod using the data in pod json   kubectl replace  f   pod json        Replace a pod based on the JSON passed into stdin   cat pod json   kubectl replace  f          Update a single container pod s image version  tag  to v4   kubectl get pod mypod  o yaml   sed  s   image  myimage        1 v4     kubectl replace  f          Force replace  delete and then re create the resource   kubectl replace   force  f   pod json               table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    allow missing template keys nbsp  nbsp  nbsp  nbsp  nbsp Default  true  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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   p   td    tr    tr   td colspan  2    cascade string   background   nbsp  nbsp  nbsp  nbsp  nbsp Default   background   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Must be  quot background quot    quot orphan quot   or  quot foreground quot   Selects the deletion cascading strategy for the dependents  e g  Pods created by a ReplicationController   Defaults to background   p   td    tr    tr   td colspan  2    dry run string   unchanged   nbsp  nbsp  nbsp  nbsp  nbsp Default   none   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Must be  quot none quot    quot server quot   or  quot client quot   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   p   td    tr    tr   td colspan  2    field manager string nbsp  nbsp  nbsp  nbsp  nbsp Default   kubectl replace   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of the manager used to track field ownership   p   td    tr    tr   td colspan  2   f    filename strings  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The files that contain the configurations to replace   p   td    tr    tr   td colspan  2    force  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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   p   td    tr    tr   td colspan  2    grace period int nbsp  nbsp  nbsp  nbsp  nbsp Default   1  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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    p   td    tr    tr   td colspan  2   h    help  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p help for replace  p   td    tr    tr   td colspan  2   k    kustomize string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Process a kustomization directory  This flag can t be used together with  f or  R   p   td    tr    tr   td colspan  2   o    output string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Output format  One of   json  yaml  name  go template  go template file  template  templatefile  jsonpath  jsonpath as json  jsonpath file    p   td    tr    tr   td colspan  2    raw string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Raw URI to PUT to the server   Uses the transport specified by the kubeconfig file   p   td    tr    tr   td colspan  2   R    recursive  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Process the directory used in  f    filename recursively  Useful when you want to manage related manifests organized within the same directory   p   td    tr    tr   td colspan  2    save config  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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   p   td    tr    tr   td colspan  2    show managed fields  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  keep the managedFields when printing objects in JSON or YAML format   p   td    tr    tr   td colspan  2    subresource string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If specified  replace will operate on the subresource of the requested object  Must be one of  status scale   This flag is beta and may change in the future   p   td    tr    tr   td colspan  2    template string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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    p   td    tr    tr   td colspan  2    timeout duration  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The length of time to wait before giving up on a delete  zero means determine a timeout from the size of the object  p   td    tr    tr   td colspan  2    validate string   strict   nbsp  nbsp  nbsp  nbsp  nbsp Default   strict   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Must be one of  strict  or true   warn  ignore  or false   br   quot true quot  or  quot strict quot  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  br   quot warn quot  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  quot ignore quot  otherwise  br   quot false quot  or  quot ignore quot  will not perform any schema validation  silently dropping any unknown or duplicate fields   p   td    tr    tr   td colspan  2    wait  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  wait for resources to be gone before returning  This waits for finalizers   p   td    tr     tbody    table              table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    as string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username to impersonate for the operation  User could be a regular user or a service account in a namespace   p   td    tr    tr   td colspan  2    as group strings  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Group to impersonate for the operation  this flag can be repeated to specify multiple groups   p   td    tr    tr   td colspan  2    as uid string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p UID to impersonate for the operation   p   td    tr    tr   td colspan  2    cache dir string nbsp  nbsp  nbsp  nbsp  nbsp Default    HOME  kube cache   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Default cache directory  p   td    tr    tr   td colspan  2    certificate authority string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a cert file for the certificate authority  p   td    tr    tr   td colspan  2    client certificate string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client certificate file for TLS  p   td    tr    tr   td colspan  2    client key string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client key file for TLS  p   td    tr    tr   td colspan  2    cluster string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig cluster to use  p   td    tr    tr   td colspan  2    context string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig context to use  p   td    tr    tr   td colspan  2    default not ready toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for notReady NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    default unreachable toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for unreachable NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    disable compression  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  opt out of response compression for all requests to the server  p   td    tr    tr   td colspan  2    insecure skip tls verify  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  the server s certificate will not be checked for validity  This will make your HTTPS connections insecure  p   td    tr    tr   td colspan  2    kubeconfig string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to the kubeconfig file to use for CLI requests   p   td    tr    tr   td colspan  2    match server version  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Require server version to match client version  p   td    tr    tr   td colspan  2   n    namespace string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  the namespace scope for this CLI request  p   td    tr    tr   td colspan  2    password string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Password for basic authentication to the API server  p   td    tr    tr   td colspan  2    profile string nbsp  nbsp  nbsp  nbsp  nbsp Default   none   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of profile to capture  One of  none cpu heap goroutine threadcreate block mutex   p   td    tr    tr   td colspan  2    profile output string nbsp  nbsp  nbsp  nbsp  nbsp Default   profile pprof   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of the file to write the profile to  p   td    tr    tr   td colspan  2    request timeout string nbsp  nbsp  nbsp  nbsp  nbsp Default   0   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The length of time to wait before giving up on a single server request  Non zero values should contain a corresponding time unit  e g  1s  2m  3h   A value of zero means don t timeout requests   p   td    tr    tr   td colspan  2   s    server string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The address and port of the Kubernetes API server  p   td    tr    tr   td colspan  2    storage driver buffer duration duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Writes in the storage driver will be buffered for this duration  and committed to the non memory backends as a single transaction  p   td    tr    tr   td colspan  2    storage driver db string nbsp  nbsp  nbsp  nbsp  nbsp Default   cadvisor   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database name  p   td    tr    tr   td colspan  2    storage driver host string nbsp  nbsp  nbsp  nbsp  nbsp Default   localhost 8086   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database host port  p   td    tr    tr   td colspan  2    storage driver password string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database password  p   td    tr    tr   td colspan  2    storage driver secure  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p use secure connection with database  p   td    tr    tr   td colspan  2    storage driver table string nbsp  nbsp  nbsp  nbsp  nbsp Default   stats   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p table name  p   td    tr    tr   td colspan  2    storage driver user string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database username  p   td    tr    tr   td colspan  2    tls server name string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Server name to use for server certificate validation  If it is not provided  the hostname used to contact the server is used  p   td    tr    tr   td colspan  2    token string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Bearer token for authentication to the API server  p   td    tr    tr   td colspan  2    user string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig user to use  p   td    tr    tr   td colspan  2    username string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username for basic authentication to the API server  p   td    tr    tr   td colspan  2    version version  true   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p   version    version raw prints version information and quits    version vX Y Z    sets the reported version  p   td    tr    tr   td colspan  2    warnings as errors  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Treat warnings received from the server as errors and exit with a non zero exit code  p   td    tr     tbody    table             kubectl     kubectl      kubectl controls the Kubernetes cluster manager


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

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

##

Display one or many resources.

 Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in the current namespace if you don't specify any namespace.

 By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resources.

Use "kubectl api-resources" for a complete list of supported resources.

```
kubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]
```

##

```
  # List all pods in ps output format
  kubectl get pods

  # List all pods in ps output format with more information (such as node name)
  kubectl get pods -o wide

  # List a single replication controller with specified NAME in ps output format
  kubectl get replicationcontroller web

  # List deployments in JSON output format, in the "v1" version of the "apps" API group
  kubectl get deployments.v1.apps -o json

  # List a single pod in JSON output format
  kubectl get -o json pod web-pod-13je7

  # List a pod identified by type and name specified in "pod.yaml" in JSON output format
  kubectl get -f pod.yaml -o json

  # List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml
  kubectl get -k dir/

  # Return only the phase value of the specified pod
  kubectl get -o template pod/web-pod-13je7 --template=

  # List resource information in custom columns
  kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image

  # List all replication controllers and services together in ps output format
  kubectl get rc,services

  # List one or more resources by their type and names
  kubectl get rc/web service/frontend pods/web-pod-13je7

  # List the 'status' subresource for a single pod
  kubectl get pod web-pod-13je7 --subresource status

  # List all deployments in namespace 'backend'
  kubectl get deployments.apps --namespace backend

  # List all pods existing in all namespaces
  kubectl get pods --all-namespaces
```

##

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

-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.

--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.

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

Filename, directory, or URL to files identifying the resource to get from a server.

-h, --help

help for get

--ignore-not-found

If the requested object does not exist the command will return exit code 0.

-k, --kustomize string

Process the kustomization directory. This flag can't be used together with -f or -R.

-L, --label-columns strings

Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2...

--no-headers

When using the default or custom-column output format, don't print headers (default print headers).

-o, --output string

Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file, custom-columns, custom-columns-file, wide). See custom columns [https://kubernetes.io/docs/reference/kubectl/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [https://kubernetes.io/docs/reference/kubectl/jsonpath/].

--output-watch-events

Output watch event objects when --watch or --watch-only is used. Existing objects are output as initial ADDED events.

--raw string

Raw URI to request from 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.

--server-print     Default: true

If true, have the server return the appropriate table output. Supports extension APIs and CRDs.

--show-kind

If present, list the resource type for the requested object(s).

--show-labels

When printing, show all labels as the last column (default hide labels column)

--show-managed-fields

If true, keep the managedFields when printing objects in JSON or YAML format.

--sort-by string

If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.

--subresource string

If specified, gets the subresource of the requested object. Must be one of [status scale]. This flag is beta and may change in the future.

--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].

-w, --watch

After listing/getting the requested object, watch for changes.

--watch-only

Watch for changes to the requested object(s), without listing/getting first.

##

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

--as string

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

--as-group strings

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

--as-uid string

UID to impersonate for the operation.

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

Default cache directory

--certificate-authority string

Path to a cert file for the certificate authority

--client-certificate string

Path to a client certificate file for TLS

--client-key string

Path to a client key file for TLS

--cluster string

The name of the kubeconfig cluster to use

--context string

The name of the kubeconfig context to use

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

Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.

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

Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.

--disable-compression

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

--insecure-skip-tls-verify

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

--kubeconfig string

Path to the kubeconfig file to use for CLI requests.

--match-server-version

Require server version to match client version

-n, --namespace string

If present, the namespace scope for this CLI request

--password string

Password for basic authentication to the API server

--profile string     Default: "none"

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

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

Name of the file to write the profile to

--request-timeout string     Default: "0"

The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.

-s, --server string

The address and port of the Kubernetes API server

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

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

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

database name

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

database host:port

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

database password

--storage-driver-secure

use secure connection with database

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

table name

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

database username

--tls-server-name string

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

--token string

Bearer token for authentication to the API server

--user string

The name of the kubeconfig user to use

--username string

Username for basic authentication to the API server

--version version[=true]

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

--warnings-as-errors

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

##

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

title  kubectl get content type  tool reference weight  30 auto generated  true no list  true            The file is auto generated from the Go source code of the component using a generic  generator  https   github com kubernetes sigs reference docs    To learn how to generate the reference documentation  please read  Contributing to the reference documentation   docs contribute generate ref docs    To update the reference content  please follow the  Contributing upstream   docs contribute generate ref docs contribute upstream   guide  You can file document formatting bugs against the  reference docs  https   github com kubernetes sigs reference docs   project              Display one or many resources    Prints a table of the most important information about the specified resources  You can filter the list using a label selector and the   selector flag  If the desired resource type is namespaced you will only see results in the current namespace if you don t specify any namespace    By specifying the output as  template  and providing a Go template as the value of the   template flag  you can filter the attributes of the fetched resources   Use  kubectl api resources  for a complete list of supported resources       kubectl get    o   output  json yaml name go template go template file template templatefile jsonpath jsonpath as json jsonpath file custom columns custom columns file wide   TYPE  VERSION   GROUP   NAME    l label    TYPE  VERSION   GROUP  NAME       flags                    List all pods in ps output format   kubectl get pods        List all pods in ps output format with more information  such as node name    kubectl get pods  o wide        List a single replication controller with specified NAME in ps output format   kubectl get replicationcontroller web        List deployments in JSON output format  in the  v1  version of the  apps  API group   kubectl get deployments v1 apps  o json        List a single pod in JSON output format   kubectl get  o json pod web pod 13je7        List a pod identified by type and name specified in  pod yaml  in JSON output format   kubectl get  f pod yaml  o json        List resources from a directory with kustomization yaml   e g  dir kustomization yaml   kubectl get  k dir         Return only the phase value of the specified pod   kubectl get  o template pod web pod 13je7   template         List resource information in custom columns   kubectl get pod test pod  o custom columns CONTAINER  spec containers 0  name IMAGE  spec containers 0  image        List all replication controllers and services together in ps output format   kubectl get rc services        List one or more resources by their type and names   kubectl get rc web service frontend pods web pod 13je7        List the  status  subresource for a single pod   kubectl get pod web pod 13je7   subresource status        List all deployments in namespace  backend    kubectl get deployments apps   namespace backend        List all pods existing in all namespaces   kubectl get pods   all namespaces               table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2   A    all namespaces  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  list the requested object s  across all namespaces  Namespace in current context is ignored even if specified with   namespace   p   td    tr    tr   td colspan  2    allow missing template keys nbsp  nbsp  nbsp  nbsp  nbsp Default  true  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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   p   td    tr    tr   td colspan  2    chunk size int nbsp  nbsp  nbsp  nbsp  nbsp Default  500  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Return large lists in chunks rather than all at once  Pass 0 to disable  This flag is beta and may change in the future   p   td    tr    tr   td colspan  2    field selector string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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   p   td    tr    tr   td colspan  2   f    filename strings  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Filename  directory  or URL to files identifying the resource to get from a server   p   td    tr    tr   td colspan  2   h    help  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p help for get  p   td    tr    tr   td colspan  2    ignore not found  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If the requested object does not exist the command will return exit code 0   p   td    tr    tr   td colspan  2   k    kustomize string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Process the kustomization directory  This flag can t be used together with  f or  R   p   td    tr    tr   td colspan  2   L    label columns strings  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Accepts a comma separated list of labels that are going to be presented as columns  Names are case sensitive  You can also use multiple flag options like  L label1  L label2     p   td    tr    tr   td colspan  2    no headers  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p When using the default or custom column output format  don t print headers  default print headers    p   td    tr    tr   td colspan  2   o    output string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Output format  One of   json  yaml  name  go template  go template file  template  templatefile  jsonpath  jsonpath as json  jsonpath file  custom columns  custom columns file  wide   See custom columns  https   kubernetes io docs reference kubectl  custom columns   golang template  http   golang org pkg text template  pkg overview  and jsonpath template  https   kubernetes io docs reference kubectl jsonpath     p   td    tr    tr   td colspan  2    output watch events  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Output watch event objects when   watch or   watch only is used  Existing objects are output as initial ADDED events   p   td    tr    tr   td colspan  2    raw string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Raw URI to request from the server   Uses the transport specified by the kubeconfig file   p   td    tr    tr   td colspan  2   R    recursive  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Process the directory used in  f    filename recursively  Useful when you want to manage related manifests organized within the same directory   p   td    tr    tr   td colspan  2   l    selector string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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   p   td    tr    tr   td colspan  2    server print nbsp  nbsp  nbsp  nbsp  nbsp Default  true  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  have the server return the appropriate table output  Supports extension APIs and CRDs   p   td    tr    tr   td colspan  2    show kind  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  list the resource type for the requested object s    p   td    tr    tr   td colspan  2    show labels  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p When printing  show all labels as the last column  default hide labels column   p   td    tr    tr   td colspan  2    show managed fields  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  keep the managedFields when printing objects in JSON or YAML format   p   td    tr    tr   td colspan  2    sort by string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If non empty  sort list types using this field specification   The field specification is expressed as a JSONPath expression  e g     metadata name     The field in the API resource specified by this JSONPath expression must be an integer or a string   p   td    tr    tr   td colspan  2    subresource string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If specified  gets the subresource of the requested object  Must be one of  status scale   This flag is beta and may change in the future   p   td    tr    tr   td colspan  2    template string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p 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    p   td    tr    tr   td colspan  2   w    watch  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p After listing getting the requested object  watch for changes   p   td    tr    tr   td colspan  2    watch only  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Watch for changes to the requested object s   without listing getting first   p   td    tr     tbody    table              table style  width  100   table layout  fixed     colgroup   col span  1  style  width  10px       col span  1       colgroup   tbody    tr   td colspan  2    as string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username to impersonate for the operation  User could be a regular user or a service account in a namespace   p   td    tr    tr   td colspan  2    as group strings  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Group to impersonate for the operation  this flag can be repeated to specify multiple groups   p   td    tr    tr   td colspan  2    as uid string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p UID to impersonate for the operation   p   td    tr    tr   td colspan  2    cache dir string nbsp  nbsp  nbsp  nbsp  nbsp Default    HOME  kube cache   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Default cache directory  p   td    tr    tr   td colspan  2    certificate authority string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a cert file for the certificate authority  p   td    tr    tr   td colspan  2    client certificate string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client certificate file for TLS  p   td    tr    tr   td colspan  2    client key string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to a client key file for TLS  p   td    tr    tr   td colspan  2    cluster string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig cluster to use  p   td    tr    tr   td colspan  2    context string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig context to use  p   td    tr    tr   td colspan  2    default not ready toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for notReady NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    default unreachable toleration seconds int nbsp  nbsp  nbsp  nbsp  nbsp Default  300  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Indicates the tolerationSeconds of the toleration for unreachable NoExecute that is added by default to every pod that does not already have such a toleration   p   td    tr    tr   td colspan  2    disable compression  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  opt out of response compression for all requests to the server  p   td    tr    tr   td colspan  2    insecure skip tls verify  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If true  the server s certificate will not be checked for validity  This will make your HTTPS connections insecure  p   td    tr    tr   td colspan  2    kubeconfig string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Path to the kubeconfig file to use for CLI requests   p   td    tr    tr   td colspan  2    match server version  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Require server version to match client version  p   td    tr    tr   td colspan  2   n    namespace string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p If present  the namespace scope for this CLI request  p   td    tr    tr   td colspan  2    password string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Password for basic authentication to the API server  p   td    tr    tr   td colspan  2    profile string nbsp  nbsp  nbsp  nbsp  nbsp Default   none   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of profile to capture  One of  none cpu heap goroutine threadcreate block mutex   p   td    tr    tr   td colspan  2    profile output string nbsp  nbsp  nbsp  nbsp  nbsp Default   profile pprof   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Name of the file to write the profile to  p   td    tr    tr   td colspan  2    request timeout string nbsp  nbsp  nbsp  nbsp  nbsp Default   0   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The length of time to wait before giving up on a single server request  Non zero values should contain a corresponding time unit  e g  1s  2m  3h   A value of zero means don t timeout requests   p   td    tr    tr   td colspan  2   s    server string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The address and port of the Kubernetes API server  p   td    tr    tr   td colspan  2    storage driver buffer duration duration nbsp  nbsp  nbsp  nbsp  nbsp Default  1m0s  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Writes in the storage driver will be buffered for this duration  and committed to the non memory backends as a single transaction  p   td    tr    tr   td colspan  2    storage driver db string nbsp  nbsp  nbsp  nbsp  nbsp Default   cadvisor   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database name  p   td    tr    tr   td colspan  2    storage driver host string nbsp  nbsp  nbsp  nbsp  nbsp Default   localhost 8086   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database host port  p   td    tr    tr   td colspan  2    storage driver password string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database password  p   td    tr    tr   td colspan  2    storage driver secure  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p use secure connection with database  p   td    tr    tr   td colspan  2    storage driver table string nbsp  nbsp  nbsp  nbsp  nbsp Default   stats   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p table name  p   td    tr    tr   td colspan  2    storage driver user string nbsp  nbsp  nbsp  nbsp  nbsp Default   root   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p database username  p   td    tr    tr   td colspan  2    tls server name string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Server name to use for server certificate validation  If it is not provided  the hostname used to contact the server is used  p   td    tr    tr   td colspan  2    token string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Bearer token for authentication to the API server  p   td    tr    tr   td colspan  2    user string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p The name of the kubeconfig user to use  p   td    tr    tr   td colspan  2    username string  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Username for basic authentication to the API server  p   td    tr    tr   td colspan  2    version version  true   td    tr   tr   td   td  td style  line height  130   word wrap  break word    p   version    version raw prints version information and quits    version vX Y Z    sets the reported version  p   td    tr    tr   td colspan  2    warnings as errors  td    tr   tr   td   td  td style  line height  130   word wrap  break word    p Treat warnings received from the server as errors and exit with a non zero exit code  p   td    tr     tbody    table             kubectl     kubectl      kubectl controls the Kubernetes cluster manager