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
or {{< glossary_tooltip text="operators" term_id="operator-pattern" >}} that
164
175
adjust their behavior based on a ConfigMap.
165
-
{{< /note >}}
166
176
167
177
### Using ConfigMaps as files from a Pod
168
178
169
179
To consume a ConfigMap in a volume in a Pod:
170
180
171
-
1. Create a config map or use an existing one. Multiple Pods can reference the same config map.
172
-
1. Modify your Pod definition to add a volume under `.spec.volumes[]`. Name the volume anything, and have a `.spec.volumes[].configMap.name` field set to reference your ConfigMap object.
173
-
1. Add a `.spec.containers[].volumeMounts[]` to each container that needs the config map. Specify `.spec.containers[].volumeMounts[].readOnly = true` and `.spec.containers[].volumeMounts[].mountPath` to an unused directory name where you would like the config map to appear.
174
-
1. Modify your image or command line so that the program looks for files in that directory. Each key in the config map `data` map becomes the filename under `mountPath`.
181
+
1. Create a ConfigMap or use an existing one. Multiple Pods can reference the
182
+
same ConfigMap.
183
+
1. Modify your Pod definition to add a volume under `.spec.volumes[]`. Name
184
+
the volume anything, and have a `.spec.volumes[].configMap.name` field set
185
+
to reference your ConfigMap object.
186
+
1. Add a `.spec.containers[].volumeMounts[]` to each container that needs the
187
+
ConfigMap. Specify `.spec.containers[].volumeMounts[].readOnly = true` and
188
+
`.spec.containers[].volumeMounts[].mountPath`to an unused directory name
189
+
where you would like the ConfigMap to appear.
190
+
1. Modify your image or command line so that the program looks for files in
191
+
that directory. Each key in the ConfigMap `data` map becomes the filename
192
+
under `mountPath`.
175
193
176
194
This is an example of a Pod that mounts a ConfigMap in a volume:
177
195
@@ -201,8 +219,8 @@ own `volumeMounts` block, but only one `.spec.volumes` is needed per ConfigMap.
201
219
202
220
#### Mounted ConfigMaps are updated automatically
203
221
204
-
When a config map currently consumed in a volume is updated, projected keys are eventually updated as well.
205
-
The kubelet checks whether the mounted config map is fresh on every periodic sync.
222
+
When a ConfigMap currently consumed in a volume is updated, projected keys are eventually updated as well.
223
+
The kubelet checks whether the mounted ConfigMap is fresh on every periodic sync.
206
224
However, the kubelet uses its local cache for getting the current value of the ConfigMap.
207
225
The type of the cache is configurable using the `ConfigMapAndSecretChangeDetectionStrategy` field in
208
226
the [KubeletConfiguration struct](https://github.com/kubernetes/kubernetes/blob/{{< param "docsbranch" >}}/staging/src/k8s.io/kubelet/config/v1beta1/types.go).
@@ -224,12 +242,13 @@ data has the following advantages:
224
242
225
243
- protects you from accidental (or unwanted) updates that could cause applications outages
226
244
- improves performance of your cluster by significantly reducing load on kube-apiserver, by
227
-
closing watches for config maps marked as immutable.
245
+
closing watches for ConfigMaps marked as immutable.
246
+
247
+
This feature is controlled by the `ImmutableEphemeralVolumes`
0 commit comments