I'm new to K8S and learning it on the job. Recently there is a requirement to run a cron job which should invoke a REST end point by posting a payload periodically. Currently I've written a config map which has the payload. I've successfully build the job and it is working fine.
Payload value will differ from environment to environment. How can I achieve this within a single cron job and config map ?
ConfigMap contains key/value pairs. As such, you can use the key as the identifier for each environment and the value as the configuration details. You then mount your configuration using either volumes or environment variables as explained here. Then, it is the responsibility of your containers to select the key which corresponds to the right environment and load its details accordingly.