Make exec more consistent with the rest of the kubectl commands.

This commit is contained in:
Brendan Burns
2015-05-20 16:00:19 -07:00
parent b7caedeedb
commit 2ec4b409e1
7 changed files with 103 additions and 28 deletions

View File

@@ -8,17 +8,20 @@ Execute a command in a container.
Execute a command in a container.
```
kubectl exec -p POD -c CONTAINER -- COMMAND [args...]
kubectl exec POD -c CONTAINER -- COMMAND [args...]
```
### Examples
```
// get output from running 'date' from pod 123456-7890, using the first container by default
$ kubectl exec 123456-7890 date
// get output from running 'date' in ruby-container from pod 123456-7890
$ kubectl exec -p 123456-7890 -c ruby-container date
$ kubectl exec 123456-7890 -c ruby-container date
//switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780 and sends stdout/stderr from 'bash' back to the client
$ kubectl exec -p 123456-7890 -c ruby-container -i -t -- bash -il
$ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
```
### Options
@@ -63,6 +66,6 @@ $ kubectl exec -p 123456-7890 -c ruby-container -i -t -- bash -il
### SEE ALSO
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra at 2015-05-21 10:33:11.186469192 +0000 UTC
###### Auto generated by spf13/cobra at 2015-05-27 22:47:02.898315735 +0000 UTC
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/kubectl_exec.md?pixel)]()

View File

@@ -141,11 +141,14 @@ Execute a command in a container.
.RS
.nf
// get output from running 'date' from pod 123456\-7890, using the first container by default
$ kubectl exec 123456\-7890 date
// get output from running 'date' in ruby\-container from pod 123456\-7890
$ kubectl exec \-p 123456\-7890 \-c ruby\-container date
$ kubectl exec 123456\-7890 \-c ruby\-container date
//switch to raw terminal mode, sends stdin to 'bash' in ruby\-container from pod 123456\-780 and sends stdout/stderr from 'bash' back to the client
$ kubectl exec \-p 123456\-7890 \-c ruby\-container \-i \-t \-\- bash \-il
$ kubectl exec 123456\-7890 \-c ruby\-container \-i \-t \-\- bash \-il
.fi
.RE