Using Kubernetes ConfigMap for Configuration Management Services

Follow the steps to use configuration management with ConfigMaps

  1. Export the application properties file for the profile containing the module properties. For more information, see Tokenizing Application Properties for exporting in the Properties file.
  2. Add a profile name to the exported properties file. For example, BW_PROFILE=Prod.
  3. Create a Kubernetes ConfigMap using the following command:
    kubectl create configmap <Name-of-config-map> --from-env-file=<name-of-exported-file>.properties
    
  4. Add the created ConfigMap to the Kubernetes pod specification as follows:
    apiVersion: v1
    kind: Pod
    metadata:
      name: bookstore-demo
      labels:
        app: bookstore-demo
    spec:
      containers:
      - name: bookstore-demo
        image: bookstore-demo:2.4.4
        imagePullPolicy: Never
        envFrom:
        - configMapRef:
          name: <Name-of-config-map>
  5. When a pod is created using above specification, the application picks the values of the tokenized module properties in the application from ConfigMap. What should user do next. Can be some instruction or some xref link.