Add config maps to your namespaces

How to use manage Kubernetes Config Maps with Codefresh

Many applications require configuration with files, environment variables and command line arguments. It makes applications portable and easily manageable. It’s pretty easy to configure an application with this way. But it can become very hard to support tons of config files for different environments and hundreds of microservices.

Kubernetes provides an elegant and very convenient way for application configuration. This way is by using configuration maps. You can find more details about config maps at https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/.

You can manage all your cluster configuration using Codefresh. This article will explain you how to do it.

View existing config maps

In order to access the list of existing config maps, open the Kubernetes Services page and switch to list view.

Select a namespace and hover your mouse pointer on it. Click the gear button which appears at the end of the row. You will see a list of all config maps inside this namespace, including date of creation and number of configuration variables inside these maps.

Change View

Change View

Add a new config map

To add a new config map for the selected namespace, open the list of all config maps and click “Create a New Config Map” button.

Screen Shot 2017-10-08 at 9.10.15 AM.png

In the config map form that will open, enter a name, add variables and click the “Create” button.

Screen Shot 2017-10-08 at 9.10.22 AM.png

You can add variables to your config maps in several ways:

Add a single variable in config map

This is the easiest way to add a variable inside the config map. It’s very useful when you want to quickly create a small configmap with 1-2 variables inside.

  1. enter key name
  2. enter key value
  3. click “ADD VARIABLE”

Screen Shot 2017-10-08 at 9.10.29 AM.png

Import variables from text / file

If you already have configuration variables inside a *.property file you can easily import it inside your configmap.

To import from text:

  1. click “IMPORT FROM TEXT”
  2. copy text from file and insert inside text area
  3. click apply

Screen Shot 2017-10-08 at 9.10.39 AM.png

To import from file:

  1. click “IMPORT FROM FILE”
  2. select file from your computer and click open button

Copy from existing config map

You can easily copy a previously created config map file and use it in other namespaces using the following steps:

  1. click “COPY FROM EXISTING CONFIG MAP”
  2. select cluster and namespace which contains configmap that you want to copy
  3. find this configmap inside the list and click “SELECT” button

Screen Shot 2017-10-08 at 9.11.03 AM.png

Edit / remove config maps

You can easily edit / remove variables for each of your config maps.

  1. Select a config map
  2. Click on pencil icon
  3. You can add new variables using the same instructions as in “add new config map” section

Screen Shot 2017-10-08 at 9.22.27 AM.png

To remove a config map, click on “remove” icon in the selected row. After your confirmation, the configmap will be removed.