Separating configuration from application code using ConfigMaps

The ConfigMap resource is used to separate data from a pod running an application. These kinds of resource contain arbitrary data to be injected into a pod as configuration. Injection in this context means that the pod can use it in the following ways:

  • Export its key/value pairs as environment variables
  • Supply its values as command-line arguments to the application
  • Mount it as a volume inside the pod to the location where the application expects to find its configuration file

Before you begin, make sure you are logged in as an unprivileged user for the most representative experience:

# oc login -u alice

Let's look at the process of exporting ConfigMap as an environment variable ...

Get Learn OpenShift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.