I am very new to k8s so bare with me…
I am using AWS EKS with RDB and Redis and I’m having a bit of an issue figuring out how to scale properly.
Currently I am running an app that basically consists of 3 deployments.
Deployment 1 is my front end deployment that has an nginx/laravel pod
Deployment 2 is my scheduler deployment that is running artisan schedule on a single pod
Deployment 3 is my worker pod that is running artisan queue which picks up redis jobs to process
Everything works great, I can run jobs and the scheduler deployment will pick them up. I can manually specify replicas on my worker deployment and each replica will pick up a job. Great.
What I am trying to accomplish though is the following:
I want to run all of the front end (deployment 1 and deployment 2) on a small ec2 instance (node?) and run my workers on much larger ec2 instances when redis jobs are in the queue.
Ideally, the “worker” ec2 instance will only spin up when Redis has jobs that need to be done. This is to save some bucks on the much larger instances that are needed to process the amount of data we need to process.
Once the worker ec2 instance spins up, it will start processing jobs and then automatically scale the worker pods to handle more jobs. If the initial worker ec2 instance becomes maxed out with (pods) work, it should spin another ec2 instance.
This should continue scaling in this way until the jobs that need to be finished are all done.
After that, we start to scale down the worker pods, then scale down ec2 instances until we are left with just the front end (much smaller ec2 instance).
Sorry if some if this is wrong/doesn’t make sense, I’m really fresh with all of this and i’m trying my hardest to wrap my brain around it all.
Can this be done out of the box? If not, what should I be reading about? Am I close? Waaaay off? Any help would be greatly appreciated! Thanks!