Merge pull request #20859 from sharet-adl/patch-2
pipe char escape, flag --server-print, labels sample, exec extra --, config NLpull/20648/head
commit
024cbb184b
|
@ -91,7 +91,7 @@ Operation | Syntax | Description
|
|||
`port-forward` | `kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]` | Forward one or more local ports to a pod.
|
||||
`proxy` | `kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]` | Run a proxy to the Kubernetes API server.
|
||||
`replace` | `kubectl replace -f FILENAME` | Replace a resource from a file or stdin.
|
||||
`run` | `kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=server|client|none] [--overrides=inline-json] [flags]` | Run a specified image on the cluster.
|
||||
`run` | </code>kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=server|client|none] [--overrides=inline-json] [flags]</code> | Run a specified image on the cluster.
|
||||
`scale` | <code>kubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags]</code> | Update the size of the specified replication controller.
|
||||
`version` | `kubectl version [--client] [flags]` | Display the Kubernetes version running on the client and server.
|
||||
|
||||
|
@ -243,8 +243,8 @@ kubectl get pods <pod-name> --server-print=false
|
|||
Output looks like this:
|
||||
|
||||
```shell
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
pod-name 1/1 Running 0 1m
|
||||
NAME AGE
|
||||
pod-name 1m
|
||||
```
|
||||
|
||||
### Sorting list objects
|
||||
|
@ -339,8 +339,8 @@ the pods running on it, the events generated for the node etc.
|
|||
# Delete a pod using the type and name specified in the pod.yaml file.
|
||||
kubectl delete -f pod.yaml
|
||||
|
||||
# Delete all the pods and services that have the label name=<label-name>.
|
||||
kubectl delete pods,services -l name=<label-name>
|
||||
# Delete all the pods and services that have the label '<label-key>=<label-value>'.
|
||||
kubectl delete pods,services -l <label-key>=<label-value>
|
||||
|
||||
# Delete all pods, including uninitialized ones.
|
||||
kubectl delete pods --all
|
||||
|
@ -350,13 +350,13 @@ kubectl delete pods --all
|
|||
|
||||
```shell
|
||||
# Get output from running 'date' from pod <pod-name>. By default, output is from the first container.
|
||||
kubectl exec <pod-name> date
|
||||
kubectl exec <pod-name> -- date
|
||||
|
||||
# Get output from running 'date' in container <container-name> of pod <pod-name>.
|
||||
kubectl exec <pod-name> -c <container-name> date
|
||||
kubectl exec <pod-name> -c <container-name> -- date
|
||||
|
||||
# Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is from the first container.
|
||||
kubectl exec -ti <pod-name> /bin/bash
|
||||
kubectl exec -ti <pod-name> -- /bin/bash
|
||||
```
|
||||
|
||||
`kubectl logs` - Print the logs for a container in a pod.
|
||||
|
@ -451,7 +451,7 @@ cat ./kubectl-whoami
|
|||
|
||||
# this plugin makes use of the `kubectl config` command in order to output
|
||||
# information about the current user, based on the currently selected context
|
||||
kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config current-context)'" }}Current user: {{ .context.user }}{{ end }}{{ end }}'
|
||||
kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config current-context)'" }}Current user: {{ printf "%s\n" .context.user }}{{ end }}{{ end }}'
|
||||
```
|
||||
|
||||
Running the above plugin gives us an output containing the user for the currently selected
|
||||
|
|
Loading…
Reference in New Issue