Reputation: 1696
I m rewriting Azure Compute Services Web Role and Worker in .NET Core to work with Azure AKS. The Web Role was pretty straight forward to migrate to ASP.NET Core in AKS, but for the worker role I m a bit lost on what to do.
The worker role was just listening to Azure Service Bus queue for photos to encode. I have seen that I can run azure functions runtime on AKS and setup a Bus Queue trigger, but it seems a bit overkill to setup all the azure functions runtime for this unique tasks.
Can someone point me in the right direction on how I can achieve that using .NET Core, Service Bus Queue and if possible setup automatic scaling according to the number of queue messages or the CPU usage?
Upvotes: 1
Views: 471
Reputation: 1051
For a simple example of a .NET Core message receiver, please refer to Microsoft's Get started with Service Bus queues.
To get your .NET Core app running in the cluster, you'll need to build it into a Docker container. You should be using Docker multi-stage builds to create your run-time container. Microsoft has a good reference: Docker images for ASP.NET Core.
KEDA and Horizonal Pod Autoscaler will both increase or decrease pod count based on metrics. K8S HPA would be a good fit if you wanted to scale based on CPU utilization. KEDA has a scaler for Azure Service Bus Queues.
Upvotes: 1