<p>I have the standard 3-nodes pool in GKE.</p>
<p>I want to label 1 of these nodes to be something like <code>dev</code> or <code>test</code>, so all the pods in the namespace <code>dev</code>, <code>qa</code> or <code>stage</code> are loaded in that node, preferrably.</p>
<p>The pods in the namespace <code>prod</code> would use the other available nodes, be it 2, 3 or more nodes available.</p>
<p>Basically I want to restrict the CPU / memory load for non-important deployments to affect the <code>prod</code> deployments.</p>
<p>How can I do this automatically? Because when Google updates the nodes (for a software update) a new one is created.</p>

JorgeeFG
<p>If you want to restrict CPU/memory, using labels on nodes is not the right way to do this. Instead, set a quota on the dev/test namespace.</p>
<p><a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/policy/resource-quotas/</a></p>
<p>Basically, it would look something like this</p>
<pre><code>apiVersion: v1
  kind: ResourceQuota
  metadata:
    name: low-priority
  spec:
    hard:
      cpu: &quot;5&quot;
      memory: 1Gi
      pods: &quot;10&quot;
</code></pre>
<p>I have a blog post about this as well: <a href="https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits" rel="nofollow noreferrer">https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits</a></p>
<p>Edit:</p>
<p>If you really want to do this, I think the best way would be to use <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/node-pools" rel="nofollow noreferrer">node pools</a>, and then <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/node-pools#deploy" rel="nofollow noreferrer">tag the pods to go into a specific pool</a>.</p>
