<p>I am getting the error</p>
<pre><code>dry-run failed, reason: Invalid, error: Deployment.apps &quot;server&quot; is invalid: spec.template.spec.containers[0].env[0].valueFrom: Invalid value:
&quot;&quot;: may not be specified when `value` is not empty
</code></pre>
<p>when trying to override a value in <em>flux Kustomization</em> using <code>patchesStrategicMerge</code> like:</p>
<pre><code>  env:
  - name: DATABASE_URL
    valueFrom:
      secretKeyRef:
        name: server-db-url
        key: dburl
</code></pre>
<p>The secret <code>server-db-url</code> exists and contains the key <code>dburl</code></p>
<p>I am not sure if this has something to do with <a href="https://github.com/kubernetes/kubernetes/issues/46861" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/46861</a></p>

Thomas Einwaller
<p>As workaround (mentioned in github issue you linked) you can add &quot;value: null&quot; to configuration:</p>
<pre><code>  env:
  - name: DATABASE_URL
    value: null
    valueFrom:
      secretKeyRef:
        name: server-db-url
        key: dburl
</code></pre>
