Reflect the changed behaviour for multiple use of --from-env-file in ConfigMap creation (#32603)
* Fix 32392 - Reflect the changed behaviour for multiple from-env-file in configmap creation. * Update content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md updated suggestions. Co-authored-by: Qiming Teng <tengqm@outlook.com> Co-authored-by: Qiming Teng <tengqm@outlook.com>
This commit is contained in:
@@ -218,6 +218,7 @@ Use the option `--from-env-file` to create a ConfigMap from an env-file, for exa
|
|||||||
|
|
||||||
# Download the sample files into `configure-pod-container/configmap/` directory
|
# Download the sample files into `configure-pod-container/configmap/` directory
|
||||||
wget https://kubernetes.io/examples/configmap/game-env-file.properties -O configure-pod-container/configmap/game-env-file.properties
|
wget https://kubernetes.io/examples/configmap/game-env-file.properties -O configure-pod-container/configmap/game-env-file.properties
|
||||||
|
wget https://kubernetes.io/examples/configmap/ui-env-file.properties -O configure-pod-container/configmap/ui-env-file.properties
|
||||||
|
|
||||||
# The env-file `game-env-file.properties` looks like below
|
# The env-file `game-env-file.properties` looks like below
|
||||||
cat configure-pod-container/configmap/game-env-file.properties
|
cat configure-pod-container/configmap/game-env-file.properties
|
||||||
@@ -255,17 +256,10 @@ data:
|
|||||||
lives: "3"
|
lives: "3"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< caution >}}
|
Starting with Kubernetes v1.23, `kubectl` supports the `--from-env-file` argument to be
|
||||||
When passing `--from-env-file` multiple times to create a ConfigMap from multiple data sources, only the last env-file is used.
|
specified multiple times to create a ConfigMap from multiple data sources.
|
||||||
{{< /caution >}}
|
|
||||||
|
|
||||||
The behavior of passing `--from-env-file` multiple times is demonstrated by:
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Download the sample files into `configure-pod-container/configmap/` directory
|
|
||||||
wget https://kubernetes.io/examples/configmap/ui-env-file.properties -O configure-pod-container/configmap/ui-env-file.properties
|
|
||||||
|
|
||||||
# Create the configmap
|
|
||||||
kubectl create configmap config-multi-env-files \
|
kubectl create configmap config-multi-env-files \
|
||||||
--from-env-file=configure-pod-container/configmap/game-env-file.properties \
|
--from-env-file=configure-pod-container/configmap/game-env-file.properties \
|
||||||
--from-env-file=configure-pod-container/configmap/ui-env-file.properties
|
--from-env-file=configure-pod-container/configmap/ui-env-file.properties
|
||||||
@@ -288,8 +282,11 @@ metadata:
|
|||||||
resourceVersion: "810136"
|
resourceVersion: "810136"
|
||||||
uid: 252c4572-eb35-11e7-887b-42010a8002b8
|
uid: 252c4572-eb35-11e7-887b-42010a8002b8
|
||||||
data:
|
data:
|
||||||
|
allowed: '"true"'
|
||||||
color: purple
|
color: purple
|
||||||
|
enemies: aliens
|
||||||
how: fairlyNice
|
how: fairlyNice
|
||||||
|
lives: "3"
|
||||||
textmode: "true"
|
textmode: "true"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user