mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-05 11:12:03 +00:00
Make exec more consistent with the rest of the kubectl commands.
This commit is contained in:
@@ -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
|
||||
|
||||
[]()
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user