Connecting Reactjs app to Express server and DocumentDB (AWS MongoDB) in Kubernetes Connecting Reactjs app to Express server and DocumentDB (AWS MongoDB) in Kubernetes kubernetes kubernetes

Connecting Reactjs app to Express server and DocumentDB (AWS MongoDB) in Kubernetes


The answer is to use variables, obviously. :)

My configuration has the following:

module.exports = {    serverURL: process.env.SERVER_HOST};

and the environment variable and value are stored in a Kubernetes configmap:

kubectl create configmap backend-configmap --from-literal SERVER_HOST=$SERVER_HOST--namespace="backend" --dry-run -o yaml | kubectl apply -f -

In short, configuration should use variables and variables should be added as configmaps in Kubernetes. The deployments (pods) reference these configmaps.