4

My current task is to set up a system that pushes out notifications to specific users based on a set schedule. Having tackled the push notifications issue, I am now trying to put together a system that will actually send out those push notifications on a regular basis. Since our infrastructure is based on a Kubernetes cluster populated with ephemeral containers, a VM with cron isn't possible, so I've come down to two possible solutions:

  1. Write a process that sits in a Docker container and on a regular schedule using cron, run the task to determine what notifications to send and then send them out
  2. Write up a small process that determines what notifications need to be sent at the current point in time and schedule that as a recurring Kubernetes cron job

The first seems to be a relatively straightforward implementation that would be implemented the same way in a VM and in a Docker container, but my concern is that, in an environment where pods are expected to not last for very long, some events may be lost. The Kubernetes solution, from that standpoint, seems more robust since the scheduling occurs at a higher level than the actual container. The triggered script itself would also be simpler as it would be a one-off process that ends and then kills the container off until the next scheduled runtime.

Right now I'm leaning towards the second solution, but if anyone has some experience with putting this kind of thing in to practice it would be great to hear some other perspectives on how to implement this kind of server.

2
  • 2
    This is liable to be closed because of softwareengineering.meta.stackexchange.com/questions/8197/…
    – walpen
    Commented Jun 21, 2017 at 22:26
  • @walpen I was more hoping for some opinions on the higher-level design of the system, with a Kubernetes feature specifically being called out as one possible path to implementation. Should I reword the question to be clearer about that?
    – moberemk
    Commented Jun 22, 2017 at 15:45

1 Answer 1

1

From my opinion the second option is perfect implementation for what you’re trying to achieve since your infrastructure is based on ephemeral k8s containers. The catch though is that cron (ScheduledJobs) isn’t quite production ready yet.

Do you need to link containers for push notifications to be effected, any shared resources? This is an issue that will affect implementation. Do you need to catch for error exceptions? Most functions can be implemented on a script and let Kubernetes CronJob spec handle schedule only. If the Kubernetes option doesn't work, then the docker plus cron command is there.

Also take a look at https://github.com/wercker/cronetes , it might be worth a shot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.