@@ -18,13 +18,19 @@ in a Kubernetes Pod.
1818
1919{% capture steps %}
2020
21- ### Defining a command when you create a Pod
21+ ### Defining a command and arguments when you create a Pod
2222
23- When you create a Pod, you can specify a command and arguments for the
24- containers that run in the Pod. To specify a command, include the ` command `
25- field in the configuration file. To specify arguments for the command, include
26- the ` args ` field in the configuration file. The command that you specify in the
27- configuration file overrides the usual entry point for the container.
23+ When you create a Pod, you can define a command and arguments for the
24+ containers that run in the Pod. To define a command, include the ` command `
25+ field in the configuration file. To define arguments for the command, include
26+ the ` args ` field in the configuration file. The command and arguments that
27+ you define cannot be changed after the Pod is created.
28+
29+ The command and arguments that you define in the configuration file
30+ override the default command and arguments provided by the container image.
31+ If you define args, but do not define a command, the default command is used
32+ with your new arguments. For more information, see
33+ [ Commands and Capabilities] ( /docs/user-guide/containers/ ) .
2834
2935In this exercise, you create a Pod that runs one container. The configuration
3036file for the Pod defines a command and two arguments:
@@ -54,6 +60,24 @@ from the Pod:
5460 command-demo
5561 tcp://10.3.240.1:443
5662
63+ ### Using environment variables to define arguments
64+
65+ In the preceding example, you defined the arguments directly by
66+ providing strings. As an alternative to providing strings directly,
67+ you can define arguments by using environment variables.
68+
69+ env:
70+ - name: MESSAGE
71+ value: "hello world"
72+ command: ["/bin/echo"]
73+ args: ["$(MESSAGE)"]
74+
75+ This means you can define an argument for a Pod using any of
76+ the techniques available for defining environment variables, including
77+ [ ConfigMaps] ( /docs/user-guide/configmap/ )
78+ and
79+ [ Secrets] ( /docs/user-guide/secrets/ ) .
80+
5781{% endcapture %}
5882
5983{% capture whatsnext %}
0 commit comments