Schedule resources on preemptible node

To reduce the costs, you can run PHP pods on cheaper nodes.

Google has Preemptible machines that are up to 3 times cheaper than the normal ones, but they have the disadvantage that they only last for 24 hours. However, by using multiple pods for your site, this will make the PHP component of your site highly available, thus your site will not be affected by the restart of the machines.

To add a preemptible node pool, go to your cluster page in Google Kubernetes Engine and click ADD NODE POOL.

Then make sure to check Enable preemptible nodes from Nodes - Machine Configuration. Keep in mind that your machine type should have at least 4 vCPU and 15 GB memory, for example n1-standard-4, n2-standard-4 etc.

Add a preemptible node

The Presslabs Dashboard allows using the preemptible nodes from Google Cloud. You can schedule WordPress , Memcached pods , and MySQL pods to run on preemptible machines.

WARNING

All the scheduling modifications (setting up scheduling rules, tolerations, pod deletions and k8s node upgrades) might be with downtime and they can break your site, Memcached or MySQL if not configured properly. Be very careful with these settings.

1. Schedule WordPress preemptible machines

In order to schedule the WordPress pods to use preemptible machines, go to Site -> Scaling -> Scheduling:

Schedule WordPress

Click on the ADD A NEW RULE button from Scheduling Rules, which will allow you to select node labels, and choose the node label preemptible:

Select the preemptible rule

Finally check the Scheduling Mode to make sure you’ve set it properly. You have the following options:

  • Always - Only preemptible nodes are chosen for scheduling pods.
  • Prefer - If there are preemptible nodes available they are chosen for scheduling pods.
  • Never - Only standard nodes are chosen for scheduling pods.

Select Scheduling Mode

NOTE

After you make the scheduling settings, check the Pods Status of the nodes in question to make sure that the changes were made. If they are not yet scheduled, you can delete the respective pods, which will cause them to regenerate properly with the new scheduling rules.

2. Schedule Memcached preemptible machines

Similarly to the scheduling of the WordPress pods to use preemptible machines, you can set scheduling rules for Memcached nodes, from the Scheduling section of Memcached .

Schedule Memcached preemptible machines

3. Schedule MySQL preemptible machines

WARNING

It’s not highly recommended to schedule the MySQL pods to run on preemptible nodes, because your site performance will be affected by the restart of these nodes.

To schedule the MySQL nodes to use preemptible machines, go to Scheduling section of the MySQL Cluster , following the same process described above.

Schedule preemptible MySQL pods

Don’t forget to verify the Scheduling Mode, to be set properly.

See Also

Schedule a dedicated node pool