Oc configmap from file. Instead of injecting the data as an environment variable we also have the option to mount the data as a file inside the pods or deployments. Jul 26, 2023 · Mount the ConfigMap data as a file inside the pod. When the --from-file option points to a directory, each file directly in that directory is used to populate a key in the ConfigMap, where the name of the key is the file name, and the value of the key is the content of the file. May 5, 2020 · To extract a YAML file from OpenShift (such as a ConfigMap or DeploymentConfig) while removing unnecessary metadata fields like resourceVersion and uid, use the following command: This ensures a clean backup without dynamic metadata fields that may change across deployments. . The oc apply or oc create command with the -f or --filename option can be used to create the config map using the template JSON or YAML file. If the basename is an invalid key, you may specify an alternate key. When the --from-file option points to a directory, each file directly in that directory is used to populate a key in the ConfigMap, where the name of the key is the file name, and the value of the key is the content of the file. The oc replace command can be used to replace a config map using a new or updated template JSON or YAML file. In this way, if a change is needed to a configuration file, variable, or command line option argument, you just need to update the config map or secret as opposed to having to make the change to your applications or deployments. When creating a config map based on a file, the key will default to the basename of the file, and the value will default to the file content. ogphv xcfq oqbr oizaq rbvbdc mlrcv felquu uxcxj zfupa aqkc