Explain ConfigMap volume source items array
The existing ConfigMap concept incorrectly states that you must use different ConfigMap objects if you want to configure both environment variables and file-like configuration items at the same time. Reword to give the correct advice.
This commit is contained in:
@@ -126,25 +126,32 @@ spec:
|
|||||||
configMap:
|
configMap:
|
||||||
# Provide the name of the ConfigMap you want to mount.
|
# Provide the name of the ConfigMap you want to mount.
|
||||||
name: game-demo
|
name: game-demo
|
||||||
|
# An array of keys from the ConfigMap to create as files
|
||||||
|
items:
|
||||||
|
- key: "game.properties"
|
||||||
|
path: "game.properties"
|
||||||
|
- key: "user-interface.properties"
|
||||||
|
path: "user-interface.properties"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
A ConfigMap doesn't differentiate between single line property values and
|
A ConfigMap doesn't differentiate between single line property values and
|
||||||
multi-line file-like values.
|
multi-line file-like values.
|
||||||
What matters is how Pods and other objects consume those values.
|
What matters is how Pods and other objects consume those values.
|
||||||
|
|
||||||
For this example, defining a volume and mounting it inside the `demo`
|
For this example, defining a volume and mounting it inside the `demo`
|
||||||
container as `/config` creates four files:
|
container as `/config` creates two files,
|
||||||
|
`/config/game.properties` and `/config/user-interface.properties`,
|
||||||
|
even though there are four keys in the ConfigMap. This is because the Pod
|
||||||
|
definition specifies an `items` array in the `volumes` section.
|
||||||
|
If you omit the `items` array entirely, every key in the ConfigMap becomes
|
||||||
|
a file with the same name as the key, and you get 4 files.
|
||||||
|
|
||||||
- `/config/player_initial_lives`
|
## Using ConfigMaps
|
||||||
- `/config/ui_properties_file_name`
|
|
||||||
- `/config/game.properties`
|
|
||||||
- `/config/user-interface.properties`
|
|
||||||
|
|
||||||
If you want to make sure that `/config` only contains files with a
|
ConfigMaps can be mounted as data volumes. ConfigMaps can also be used by other
|
||||||
`.properties` extension, use two different ConfigMaps, and refer to both
|
parts of the system, without being directly exposed to the Pod. For example,
|
||||||
ConfigMaps in the `spec` for a Pod. The first ConfigMap defines
|
ConfigMaps can hold data that other parts of the system should use for configuration.
|
||||||
`player_initial_lives` and `ui_properties_file_name`. The second
|
|
||||||
ConfigMap defines the files that the kubelet places into `/config`.
|
|
||||||
|
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
The most common way to use ConfigMaps is to configure settings for
|
The most common way to use ConfigMaps is to configure settings for
|
||||||
@@ -157,12 +164,6 @@ or {{< glossary_tooltip text="operators" term_id="operator-pattern" >}} that
|
|||||||
adjust their behavior based on a ConfigMap.
|
adjust their behavior based on a ConfigMap.
|
||||||
{{< /note >}}
|
{{< /note >}}
|
||||||
|
|
||||||
## Using ConfigMaps
|
|
||||||
|
|
||||||
ConfigMaps can be mounted as data volumes. ConfigMaps can also be used by other
|
|
||||||
parts of the system, without being directly exposed to the Pod. For example,
|
|
||||||
ConfigMaps can hold data that other parts of the system should use for configuration.
|
|
||||||
|
|
||||||
### Using ConfigMaps as files from a Pod
|
### Using ConfigMaps as files from a Pod
|
||||||
|
|
||||||
To consume a ConfigMap in a volume in a Pod:
|
To consume a ConfigMap in a volume in a Pod:
|
||||||
|
|||||||
Reference in New Issue
Block a user