Use # not // for comments (#12672)

Bourne-style shells don't use //
This commit is contained in:
Tim Bannister
2019-02-17 03:55:36 +00:00
committed by Kubernetes Prow Robot
parent 7e1a07d4f1
commit 88ca365f11
+35 -35
View File
@@ -258,52 +258,52 @@ Use the following set of examples to help you familiarize yourself with running
`kubectl create` - Create a resource from a file or stdin. `kubectl create` - Create a resource from a file or stdin.
```shell ```shell
// Create a service using the definition in example-service.yaml. # Create a service using the definition in example-service.yaml.
$ kubectl create -f example-service.yaml $ kubectl create -f example-service.yaml
// Create a replication controller using the definition in example-controller.yaml. # Create a replication controller using the definition in example-controller.yaml.
$ kubectl create -f example-controller.yaml $ kubectl create -f example-controller.yaml
// Create the objects that are defined in any .yaml, .yml, or .json file within the <directory> directory. # Create the objects that are defined in any .yaml, .yml, or .json file within the <directory> directory.
$ kubectl create -f <directory> $ kubectl create -f <directory>
``` ```
`kubectl get` - List one or more resources. `kubectl get` - List one or more resources.
```shell ```shell
// List all pods in plain-text output format. # List all pods in plain-text output format.
$ kubectl get pods $ kubectl get pods
// List all pods in plain-text output format and include additional information (such as node name). # List all pods in plain-text output format and include additional information (such as node name).
$ kubectl get pods -o wide $ kubectl get pods -o wide
// List the replication controller with the specified name in plain-text output format. Tip: You can shorten and replace the 'replicationcontroller' resource type with the alias 'rc'. # List the replication controller with the specified name in plain-text output format. Tip: You can shorten and replace the 'replicationcontroller' resource type with the alias 'rc'.
$ kubectl get replicationcontroller <rc-name> $ kubectl get replicationcontroller <rc-name>
// List all replication controllers and services together in plain-text output format. # List all replication controllers and services together in plain-text output format.
$ kubectl get rc,services $ kubectl get rc,services
// List all daemon sets, including uninitialized ones, in plain-text output format. # List all daemon sets, including uninitialized ones, in plain-text output format.
$ kubectl get ds --include-uninitialized $ kubectl get ds --include-uninitialized
// List all pods running on node server01 # List all pods running on node server01
$ kubectl get pods --field-selector=spec.nodeName=server01 $ kubectl get pods --field-selector=spec.nodeName=server01
``` ```
`kubectl describe` - Display detailed state of one or more resources, including the uninitialized ones by default. `kubectl describe` - Display detailed state of one or more resources, including the uninitialized ones by default.
```shell ```shell
// Display the details of the node with name <node-name>. # Display the details of the node with name <node-name>.
$ kubectl describe nodes <node-name> $ kubectl describe nodes <node-name>
// Display the details of the pod with name <pod-name>. # Display the details of the pod with name <pod-name>.
$ kubectl describe pods/<pod-name> $ kubectl describe pods/<pod-name>
// Display the details of all the pods that are managed by the replication controller named <rc-name>. # Display the details of all the pods that are managed by the replication controller named <rc-name>.
// Remember: Any pods that are created by the replication controller get prefixed with the name of the replication controller. # Remember: Any pods that are created by the replication controller get prefixed with the name of the replication controller.
$ kubectl describe pods <rc-name> $ kubectl describe pods <rc-name>
// Describe all pods, not including uninitialized ones # Describe all pods, not including uninitialized ones
$ kubectl describe pods --include-uninitialized=false $ kubectl describe pods --include-uninitialized=false
``` ```
@@ -322,39 +322,39 @@ the pods running on it, the events generated for the node etc.
`kubectl delete` - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources. `kubectl delete` - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.
```shell ```shell
// Delete a pod using the type and name specified in the pod.yaml file. # Delete a pod using the type and name specified in the pod.yaml file.
$ kubectl delete -f pod.yaml $ kubectl delete -f pod.yaml
// Delete all the pods and services that have the label name=<label-name>. # Delete all the pods and services that have the label name=<label-name>.
$ kubectl delete pods,services -l name=<label-name> $ kubectl delete pods,services -l name=<label-name>
// Delete all the pods and services that have the label name=<label-name>, including uninitialized ones. # Delete all the pods and services that have the label name=<label-name>, including uninitialized ones.
$ kubectl delete pods,services -l name=<label-name> --include-uninitialized $ kubectl delete pods,services -l name=<label-name> --include-uninitialized
// Delete all pods, including uninitialized ones. # Delete all pods, including uninitialized ones.
$ kubectl delete pods --all $ kubectl delete pods --all
``` ```
`kubectl exec` - Execute a command against a container in a pod. `kubectl exec` - Execute a command against a container in a pod.
```shell ```shell
// Get output from running 'date' from pod <pod-name>. By default, output is from the first container. # 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>. # 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. # 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. `kubectl logs` - Print the logs for a container in a pod.
```shell ```shell
// Return a snapshot of the logs from pod <pod-name>. # Return a snapshot of the logs from pod <pod-name>.
$ kubectl logs <pod-name> $ kubectl logs <pod-name>
// Start streaming the logs from pod <pod-name>. This is similar to the 'tail -f' Linux command. # Start streaming the logs from pod <pod-name>. This is similar to the 'tail -f' Linux command.
$ kubectl logs -f <pod-name> $ kubectl logs -f <pod-name>
``` ```
@@ -363,26 +363,26 @@ $ kubectl logs -f <pod-name>
Use the following set of examples to help you familiarize yourself with writing and using `kubectl` plugins: Use the following set of examples to help you familiarize yourself with writing and using `kubectl` plugins:
```shell ```shell
// create a simple plugin in any language and name the resulting executable file # create a simple plugin in any language and name the resulting executable file
// so that it begins with the prefix "kubectl-" # so that it begins with the prefix "kubectl-"
$ cat ./kubectl-hello $ cat ./kubectl-hello
#!/bin/bash #!/bin/bash
# this plugin prints the words "hello world" # this plugin prints the words "hello world"
echo "hello world" echo "hello world"
// with our plugin written, let's make it executable # with our plugin written, let's make it executable
$ sudo chmod +x ./kubectl-hello $ sudo chmod +x ./kubectl-hello
// and move it to a location in our PATH # and move it to a location in our PATH
$ sudo mv ./kubectl-hello /usr/local/bin $ sudo mv ./kubectl-hello /usr/local/bin
// we have now created and "installed" a kubectl plugin. # we have now created and "installed" a kubectl plugin.
// we can begin using our plugin by invoking it from kubectl as if it were a regular command # we can begin using our plugin by invoking it from kubectl as if it were a regular command
$ kubectl hello $ kubectl hello
hello world hello world
// we can "uninstall" a plugin, by simply removing it from our PATH # we can "uninstall" a plugin, by simply removing it from our PATH
$ sudo rm /usr/local/bin/kubectl-hello $ sudo rm /usr/local/bin/kubectl-hello
``` ```
@@ -397,9 +397,9 @@ The following kubectl-compatible plugins are available:
/usr/local/bin/kubectl-foo /usr/local/bin/kubectl-foo
/usr/local/bin/kubectl-bar /usr/local/bin/kubectl-bar
// this command can also warn us about plugins that are # this command can also warn us about plugins that are
// not executable, or that are overshadowed by other # not executable, or that are overshadowed by other
// plugins, for example # plugins, for example
$ sudo chmod -x /usr/local/bin/kubectl-foo $ sudo chmod -x /usr/local/bin/kubectl-foo
$ kubectl plugin list $ kubectl plugin list
The following kubectl-compatible plugins are available: The following kubectl-compatible plugins are available:
@@ -428,10 +428,10 @@ Running the above plugin gives us an output containing the user for the currentl
context in our KUBECONFIG file: context in our KUBECONFIG file:
```shell ```shell
// make the file executable # make the file executable
$ sudo chmod +x ./kubectl-whoami $ sudo chmod +x ./kubectl-whoami
// and move it into our PATH # and move it into our PATH
$ sudo mv ./kubectl-whoami /usr/local/bin $ sudo mv ./kubectl-whoami /usr/local/bin
$ kubectl whoami $ kubectl whoami