Temporary config or env variable change to a specific pod


I have stateful-set with 2 pods.
Now I have a usecase where I restore any of these pods, based on an env variable which is coming from a config-map.

config-map: restore-config-map

This config-map is then used to project the configmap data as env variable inside the pods

- configMapRef:
name: restore-config-map

To restore any pod, I delete the pod, and my bootstrap script will read the value of this env variable i.e. DEPLOYMENT_TYPE which would be now “restore” and would function accordingly and would do a restore from backup.

Now the drawback with this approach is that this env variable is replicated in all my pods. And if let’s say, the other pod (which is not to be restored), got restarted somehow, it will also go into the restore flow.

Another scenario where it could create issues is scaling-out the cluster.

Is there any other way, I can only push a certain config or patch an env variable to a specific pod so that it doesn’t impact any other pod in the cluster?

Any alternative to config-map to handle such scenarios?