<p>In the pods definition, we add the nodeSelector as a child of spec. But I'm not sure how to add this in deployment yaml file</p>
<p>are we supposed to add it in the template's spec-</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata: 
  name: first-deployment
  labels: 
    app: first
spec:
  replicas: 1
  template:
    metadata:
      name: first-deployment-pod
      label: 
        app: first
    spec:
      containers:
      - name: test
        image: test/test
    nodeSelector:
      testkey: testvalue

 
</code></pre>
<p>or do we need to add it in the spec of the deplyment -</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata: 
  name: first-deployment
  labels: 
    app: first
spec:
  replicas: 1
  nodeSelector:
    testkey: testvalue
  template:
    metadata:
      name: first-deployment-pod
      label: 
        app: first
    spec:
      containers:
      - name: test
        image: test/test
    
 
</code></pre>

AYUSHI NIGAM
<p>It should be at the same level than your containers array:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata: 
  name: first-deployment
  labels: 
    app: first
spec:
  replicas: 1
  template:
    metadata:
      name: first-deployment-pod
      label: 
        app: first
    spec:
      containers:
      - name: test
        image: test/test
      nodeSelector:
        testkey: testvalue
</code></pre>
