You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/tasks/manage-kubernetes-objects/kustomization.md
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -86,12 +86,20 @@ metadata:
86
86
name: example-configmap-1-8mbdf7882g
87
87
```
88
88
89
-
To generate a ConfigMap from an env file, add an entry to the `envs` list in `configMapGenerator`. Here is an example of generating a ConfigMap with a data item from a `.env` file:
89
+
To generate a ConfigMap from an env file, add an entry to the `envs` list in `configMapGenerator`. This can also be used to set values from local environment variables by omitting the `=` and the value.
90
+
91
+
{{< note >}}
92
+
It's recommended to use the local environment variable population functionality sparingly - an overlay with a patch is often more maintainable. Setting values from the environment may be useful when they cannot easily be predicted, such as a git SHA.
93
+
{{< /note >}}
94
+
95
+
Here is an example of generating a ConfigMap with a data item from a `.env` file:
90
96
91
97
```shell
92
98
# Create a .env file
99
+
# BAZ will be populated from the local environment variable $BAZ
93
100
cat <<EOF >.env
94
101
FOO=Bar
102
+
BAZ
95
103
EOF
96
104
97
105
cat <<EOF >./kustomization.yaml
@@ -105,18 +113,19 @@ EOF
105
113
The generated ConfigMap can be examined with the following command:
0 commit comments