Improvements for markdown formatting (#12193)
* Fixed markdown formatting * Resolved usage of 'shell' instead of 'yaml' * Removed unknown 'log' keyword
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
10a75e3d72
commit
1bc0d7c385
+24
-12
@@ -46,11 +46,15 @@ file for the Pod defines a command and two arguments:
|
||||
|
||||
1. Create a Pod based on the YAML configuration file:
|
||||
|
||||
kubectl create -f https://k8s.io/examples/pods/commands.yaml
|
||||
```shell
|
||||
kubectl create -f https://k8s.io/examples/pods/commands.yaml
|
||||
```
|
||||
|
||||
1. List the running Pods:
|
||||
|
||||
kubectl get pods
|
||||
```shell
|
||||
kubectl get pods
|
||||
```
|
||||
|
||||
The output shows that the container that ran in the command-demo Pod has
|
||||
completed.
|
||||
@@ -58,13 +62,17 @@ file for the Pod defines a command and two arguments:
|
||||
1. To see the output of the command that ran in the container, view the logs
|
||||
from the Pod:
|
||||
|
||||
kubectl logs command-demo
|
||||
```shell
|
||||
kubectl logs command-demo
|
||||
```
|
||||
|
||||
The output shows the values of the HOSTNAME and KUBERNETES_PORT environment
|
||||
variables:
|
||||
|
||||
command-demo
|
||||
tcp://10.3.240.1:443
|
||||
```
|
||||
command-demo
|
||||
tcp://10.3.240.1:443
|
||||
```
|
||||
|
||||
## Use environment variables to define arguments
|
||||
|
||||
@@ -72,11 +80,13 @@ In the preceding example, you defined the arguments directly by
|
||||
providing strings. As an alternative to providing strings directly,
|
||||
you can define arguments by using environment variables:
|
||||
|
||||
env:
|
||||
- name: MESSAGE
|
||||
value: "hello world"
|
||||
command: ["/bin/echo"]
|
||||
args: ["$(MESSAGE)"]
|
||||
```yaml
|
||||
env:
|
||||
- name: MESSAGE
|
||||
value: "hello world"
|
||||
command: ["/bin/echo"]
|
||||
args: ["$(MESSAGE)"]
|
||||
```
|
||||
|
||||
This means you can define an argument for a Pod using any of
|
||||
the techniques available for defining environment variables, including
|
||||
@@ -95,8 +105,10 @@ In some cases, you need your command to run in a shell. For example, your
|
||||
command might consist of several commands piped together, or it might be a shell
|
||||
script. To run your command in a shell, wrap it like this:
|
||||
|
||||
command: ["/bin/sh"]
|
||||
args: ["-c", "while true; do echo hello; sleep 10;done"]
|
||||
```shell
|
||||
command: ["/bin/sh"]
|
||||
args: ["-c", "while true; do echo hello; sleep 10;done"]
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user