Pod number environment variable


Context: I’ve got a nodejs app running as a service on Rancher2 and soon I will be adding a cron job with a db update on the nodejs app itself. The cron job will start on app start.

Question: Is there a way that I can run the cron job only in one pod? For example, does Rancher provide something like a pod number environment variable, where I can run the cron job only in for e.g. pod 1 (while other pods e.g. 2, 3, 4 being ignored)?

I know same can be achieved by exposing the script as an endpoint and using a cron type of service on Rancher, but I wanted to avoid this additional cron service.

Thank you.