<p>I've a simle React JS application and it's using a environment variable(REACT_APP_BACKEND_SERVER_URL) defined in .env file. Now I'm trying to deploy this application to minikube using Kubernetes.</p>
<p>This is my deployment file:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-ui
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-ui
  template:
    metadata:
      name: test-ui-pod
      labels:
        app: test-ui
    spec:
      containers:
        - name: test-ui
          image: test-ui:1.0.2
          ports:
            - containerPort: 80
          env:
            - name: &quot;REACT_APP_BACKEND_SERVER_URL&quot;
              value: &quot;http://127.0.0.1:59058&quot;
</code></pre>
<p>When I run the application, it's working but REACT_APP_BACKEND_SERVER_URL is giving the value which I defined in .env file. Not the one I'm overriding. Can someone help me with this please? How to override the env variable using Kubernetes deployment?</p>

Healthy Bowl
<p>After starting the app with your deployment YAML and checking for the environment variables I see the environment variables for that environment variable.</p>
<pre><code>REACT_APP_BACKEND_SERVER_URL=http://127.0.0.1:59058
</code></pre>
<p>you can check that by doing an <code>kubectl exec -it &lt;pod-name&gt; -- sh</code> and running <code>env</code> command.</p>
<p>So you can see that <code>REACT_APP_BACKEND_SERVER_URL</code> <em>is</em> there in the environment variables.  It's available for your application to use. I suspect that you may need to understand better from the React app side on how to use the <code>.env</code> file.</p>
