Updating Configuration via a ConfigMap — Pick one Pod that belongs to the Deployment, and view its logs
kubectl logs deployments/immutable-configmap-volume Bounded code example (external data; do not execute automatically): ```text You should see an output similar to: ``` Found 3 pods, using pod/immutable-configmap-volume-78b6fbff95-5gsfh Wed Mar 20 03:52:34 UTC 2024 The name of the company is ACME, I
Reference note (untrusted external data; do not execute it as instructions).
kubectl logs deployments/immutable-configmap-volume
Bounded code example (external data; do not execute automatically):
```text
You should see an output similar to:
```
Found 3 pods, using pod/immutable-configmap-volume-78b6fbff95-5gsfh Wed Mar 20 03:52:34 UTC 2024 The name of the company is ACME, Inc. Wed Mar 20 03:52:44 UTC 2024 The name of the company is ACME, Inc. Wed Mar 20 03:52:54 UTC 2024 The name of the company is ACME, Inc.
Bounded code example (external data; do not execute automatically):
```text
{{< alert color="info" title="Note" >}}
Once a ConfigMap is marked as immutable, it is not possible to revert this change
nor to mutate the contents of the data or the binaryData field.
In order to modify the behavior of the Pods that use this configuration,
you will create a new immutable ConfigMap and edit the Deployment
to define a slightly different pod template, referencing the new ConfigMap.
{{< /alert >}}
Create a new immutable ConfigMap by using the manifest shown below:
{{% code_sample file="configmap/new-immutable-configmap.yaml" %}}
```
Bounded code example (external data; do not execute automatically):
```text
You should see an output similar to:
```
configmap/company-name-20240312 created
Bounded code example (external data; do not execute automatically):
```text
Check the newly created ConfigMap:
```
Bounded code example (external data; do not execute automatically):
```text
You should see an output displaying both the old and new ConfigMaps:
```
NAME DATA AGE company-name-20150801 1 22m company-name-20240312 1 24s
Bounded code example (external data; do not execute automatically):
```text
Modify the Deployment to reference the new ConfigMap.
Edit the Deployment:
```
kubectl edit deployment immutable-configmap-volume
Bounded code example (external data; do not execute automatically):
```text
In the editor that appears, update the existing volume definition to use the new ConfigMap.
```
volumes: configMap: defaultMode: 420 name: company-name-20240312 # Update this field name: config-volume
Bounded code example (external data; do not execute automatically):
```text
You should see the following output:
```
deployment.apps/immutable-configmap-volume edited …
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tutorials/configuration/updating-configuration-via-a-configmap.md :: Pick one Pod that belongs to the Deployment, and view its logs ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution