Application Config file using Kubernetes ConfigMaps
You can either create a ConfigMap or a Secret e.g.
apiVersion: v1kind: ConfigMapmetadata: name: test-config namespace: defaultdata: AppConfig.json: |- { "slackIncomingHook": [ {"HookUrl": "<<HookUrl>>"} ], "wikiPage": { "url": "<<url>>", "timeFrame" : "week" }, "database": { "dbName": "DBNAME", "dbHostName": "mongodb://username:password@<<IP Address>>:27017/" } }
You can create secret also as they are base64 encoded so
apiVersion: v1kind: Secretmetadata: name: test-secret namespace: defaulttype: Opaquedata: AppConfig.json: |- BASE_64_ENCODED_JSON
In the deployment, add secret/config to volumes node and set volume mounts and mountPath to the path of your config.json.
volumeMounts: - name: test-secretm mountPath: PATH_OF_YOUR_CONFIG_JSONvolumes: - name: test-secretm secret: secretName: test-secret