When we use PM2
in cluster mode, we can find out the instance number inside node app using process.env.NODE_APP_INSTANCE
, but how we can find that inside a kubernetes cluster without pm2
. I'm looking for similar like find replica instance number or etc.
Imagine a node app with 2 or more replicas and we need to run node-cron
scheduler only inside one of pods.