<p>I have created multiple stacks (node groups) within my <strong>EKS cluster</strong>, and each group runs on a <strong>different instance type</strong> (for example, one group runs on GPU instances). I have added an entry in <em>mapRoles</em> of <em>aws-auth-cm.yaml</em> file for each of the node groups. Now I would like to deploy some <em>Deployments</em> on another. The deployment files look something like this:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment-1
spec:
  replicas: 1
  selector:
    matchLabels:
      component: component-1
  template:
    metadata:
      labels:
        component: component-1
    spec:
      containers:
        - name: d1
          image: docker-container
          ports:
            - containerPort: 83
</code></pre>

<p>The documentation shows that I can run the standard command <strong>kubectl apply</strong>. Is there any way to specify the group? Maybe something like</p>

<blockquote>
  <p>kubectl apply -f server-deployment.yaml -group node-group-1</p>
</blockquote>

Alessandro
<p>Sadly something that you mentioned doesn't exist, but you can read about <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/" rel="nofollow noreferrer">Affinity</a> and it should solve your problem.</p>
<p>TL;DR you have to add labels or use existing labels on nodes and use these labels to assign pods to correct nodes.</p>
<p>Assuming you have label <code>beta.kubernetes.io/instance-type=highmem</code></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment-1
spec:
  replicas: 1
  selector:
    matchLabels:
      component: component-1
  template:
    metadata:
      labels:
        component: component-1
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: beta.kubernetes.io/instance-typ
                operator: In
                values:
                - highmem
      containers:
        - name: d1
          image: docker-container
          ports:
            - containerPort: 83
</code></pre>
