Using ConfigMaps with ActiveMatrix Service Grid - Container Edition Applications
ConfigMap stores configuration data for containers. ConfigMap separates out configurations from your Pods and components. It is easier to change and manage ConfigMaps, without hardcoding configuration data to Pod specifications. You can use ConfigMaps to pass substitution variables to applications.
- Procedure
-
Create a ConfigMap in Kubernetes.
Sample manifest file:
apiVersion: v1 kind: ConfigMap metadata: name: airport-config namespace: airport data: svar.app.TEMP_IN_UNIT: C
-
Run the following command:
kubectl create configmap <name-of-configmap-file-to-be-created>
It creates a ConfigMap with the name "airport-config" and has one application level substitution variable: svar.app.TEMP_IN_UNIT: C
-
Use this ConfigMap in the application deployment file as environment variable:
envFrom: - configMapRef: name: <name-of-the-configmap> optional: true