I have the standard 3-nodes pool in GKE.
I want to label 1 of these nodes to be something like dev or test, so all the pods in the namespace dev, qa or stage are loaded in that node, preferrably.
The pods in the namespace prod would use the other available nodes, be it 2, 3 or more nodes available.
Basically I want to restrict the CPU / memory load for non-important deployments to affect the prod deployments.
How can I do this automatically? Because when Google updates the nodes (for a software update) a new one is created.
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.
https://kubernetes.io/docs/concepts/policy/resource-quotas/
Basically, it would look something like this
apiVersion: v1
  kind: ResourceQuota
  metadata:
    name: low-priority
  spec:
    hard:
      cpu: "5"
      memory: 1Gi
      pods: "10"I have a blog post about this as well: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits
Edit:
If you really want to do this, I think the best way would be to use node pools, and then tag the pods to go into a specific pool.