Bootstrap FreeKB - OpenShift - Edit Config Map using the oc edit command
OpenShift - Edit Config Map using the oc edit command

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

There are different ways to configure a container with environment variables.

Config Maps are used to:

Secrets are similar, used to create variables that contain encoded data (e.g. passwords). 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.

flowchart TB subgraph OpenShift["OpenShift Cluster"] CM[ConfigMap
Configuration Data] SEC[Secret
Sensitive Data] subgraph Pod["Pod"] subgraph Container["Container"] APP[Application] VOL1[/Volume Mount
Config Files/] VOL2[/Volume Mount
Secret Files/] ENV1[Environment Variables
from ConfigMap] ENV2[Environment Variables
from Secret] end end end CM -->|Mount as Volume| VOL1 SEC -->|Mount as Volume| VOL2 CM -->|Inject as EnvVar| ENV1 SEC -->|Inject as EnvVar| ENV2 VOL1 -.->|Read Config| APP VOL2 -.->|Read Secrets| APP ENV1 -.->|Use Config| APP ENV2 -.->|Use Secrets| APP style CM fill:#90CAF9 style SEC fill:#FFAB91 style APP fill:#A5D6A7 style Pod fill:#E1F5FE style Container fill:#F1F8E9

The oc get configmaps command can be used to list the config maps in a namespace.

~]$ oc get configmaps --namespace default
NAME        DATA      AGE
krb5-conf   1         44d

 

The oc describe configmap command can be used to show the files, variables, and command line options that are defined in the config map.

~]$ oc describe configmap krb5-conf   
Name:         krb5-conf
Namespace:    myproject
Labels:       <none>
Annotations:  <none>

Data
====
krb5.conf:
----
[libdefaults]
 default_realm = DEFAULT.EXAMPLE.COM
 
[realms]
 DEFAULT.EXAMPLE.COM = {
  kdc = server1.default.example.com
  kdc = server2.default.example.com
 }
  
[domain_realm]
 default.example.com = DEFAULT.EXAMPLE.COM
 .default.example.com = DEFAULT.EXAMPLE.COM

Events:  <none>

 

The oc edit command can be used to edit the config map.

oc edit configmap krb5-conf 

 

If the edit is successful, meaning there are no syntax errors, something like this should be returned.

configmap/krb5-conf edited

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter db80d6 in the box below so that we can be sure you are a human.