Autoscaling Kubernetes Based On SQS Queue Size
A client that I was recently working with wanted to be able to autoscale pods when the queue in AWS SQS grew. After doing some searching around, I came across: Wattpad/kube-sqs-autoscaler. It worked pretty well until I came across an issue with it removing configuration from the manifests when autoscaling a deployment.
After doing some digging I realized that it was using an older version of the kubernetes api. There’s actually a similar issue outstanding. I tried to update the client but my unfamiliarity with go and the drift in the client api that I was trying to use lead to a lot of frustration.
I decided to write my own version of the autoscaler in python. There’s good library support for the SQS and the kubernetes api. I tried to keep the configuration as similar as possible to avoid having to rewrite my existing manifests too much. Here’s the final result: sideshowbandana/k8s-sqs-autoscaler.