I have a GKE cluster with 1 node-pool and 2 nodes in it, one with node affinity to only accept pods of production and the other to development and testing pods. For financial purposes, I want to configure like a cronJob or something similar on the dev/test node so I can spend less money but I don't know if that's possible.
CodePudding user response:
Yes, it is possible. But you should separate production and development nodes into different pools. Then you can fire up a cronjob, target that to come up in the production pool, and use that to perform the following actions:
- Turn off autoscaling on the development pool (if you use autoscaling, that is)
- Set the node pool size of the development pool to 0
Remember to fire up another cronjob to reverse the steps:
- Scale up development pool to 1
- Enable autoscaling on the development pool
CodePudding user response:
Yes, you can add another node pool named test so you can have two node pools; one to develop and one to test. You can also turn on the auto scaling in your development pool, this feature of GKE will allow you to save money because it automatically resizes your GKE Cluster node pool based on the demand workload when your production pool is not demanding and you can put a maximum of pods to limit the numbers of pods deployed; in case of your workload increase the demand.
Once you have configured the production pool, you can create the new test node pool with a fixed size of one node.
Then, you will use a node selector in your pods to make sure that they can run in the production node pool. And you could use an anti-affinity rule to ensure that two of your training pods cannot be scheduled on the same node.