<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: django-k8-web-deployment
  labels:
    app: django-k8-web-deployment

spec:
  replicas: 3

  selector:
    matchLabels:
      app: django-k8-web-deployment

  template:
    metadata:
      labels:
        app: django-k8-web-deployment
    spec:
      containers:
        - name: django-k8s-web
          image: registry.digitalocean.com/chrisocean/django-k8s-web:latest
          envFrom:
            - secretRef:
              name: django-k8s-web-prod-env
          env:
            - name: PORT
              value: &quot;8001&quot;
          ports:
            - containerPort: 8001
      imagePullSecrets:
        - name: oceandev

</code></pre>
<p>the above yaml file above is what I want to apply in kubernetes. I ran the folowing command on my terminal</p>
<pre class="lang-bash prettyprint-override"><code>kubectl apply -f k8s/apps/django-k8s-web.yaml
</code></pre>
<p>then I go the following error on the terminal</p>
<pre class="lang-bash prettyprint-override"><code>kubectl apply -f k8s/apps/django-k8s-web.yaml
service/django-k8-web-service unchanged
Error from server (BadRequest): error when creating &quot;k8s/apps/django-k8s-web.yaml&quot;: Deployment in version &quot;v1&quot; cannot be handled as a Deployment: strict decoding error: unknown field &quot;spec.template.spec.containers[0].envFrom[0].name&quot;
</code></pre>
<p>who knows how to resolve the issue?</p>
<p>I wanted it to apply the changes in the yaml file but it is not working.When I ran the following command</p>
<pre class="lang-bash prettyprint-override"><code>kubectl get pods
</code></pre>
<p>the STATUS of the pod is pending</p>

<p>This is issue with indentation.</p>
<p>Here is proper <code>deployment</code> definition</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: django-k8-web-deployment
  labels:
    app: django-k8-web-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: django-k8-web-deployment
  template:
    metadata:
      labels:
        app: django-k8-web-deployment
    spec:
      containers:
      - name: django-k8s-web
        image: registry.digitalocean.com/chrisocean/django-k8s-web:latest
        envFrom:
        - secretRef:
            name: django-k8s-web-prod-env
        env:
        - name: PORT
          value: &quot;8001&quot;
        ports:
        - containerPort: 8001
      imagePullSecrets:
      - name: oceandev
</code></pre>
