<p>I'm trying to set up a manifest with specifying the <code>ASPNETCORE_ENVIRONMENT</code> env variable:</p>
<pre><code>kubectl version 1.18.10
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>
kind: Deployment
apiVersion: apps/v1
metadata:
  name: $(appName)
  labels:
    app: $(appName)
spec:
  replicas: 2
  selector:
    matchLabels:
      app: $(appName)
  template:
    metadata:
      labels:
        app: $(appName)
    spec:
      containers:
        - name: $(appName)
          image: xxx.azurecr.io/xxx:$(Build.BuildId)
          ports:
          - name: http
            containerPort: 80
            protocol: TCP
          env:
          - name: ASPNETCORE_ENVIRONMENT
            value: Staging
</code></pre>
<p>However it's not working, validation tells me:</p>
<pre><code> ##[error]error: error validating &quot;/home/vsts/work/_temp/Deployment_xxx6_1610541107518&quot;: error validating data: ValidationError(Deployment): unknown field &quot;env&quot; in io.k8s.api.apps.v1.Deployment; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
<p>I'm using Azure Devops Release Pipeline Powershell Task &quot;Generate Kubernetes Manifest file&quot;.</p>

Sven
<p>Ok it must've been wrong formatting or indentation.
The following file is working now:</p>
<pre class="lang-yaml prettyprint-override"><code>kind: Deployment
apiVersion: apps/v1
metadata:
  name: $(appName)
  labels:
    app: $(appName)
spec:
  replicas: 2
  selector:
    matchLabels:
      app: $(appName)
  template:
    metadata:
      labels:
        app: $(appName)
    spec:
      containers:
      - name: $(appName)
        image: xxx.azurecr.io/xxx:$(Build.BuildId)
        ports:
        - containerPort: 80
        env:
        - name: ASPNETCORE_ENVIRONMENT
          value: Staging
</code></pre>
