This project enables KEDA to spawn jobs into Azure Containter Instances (ACI).
There is a known issue with ACI containers not having access to MSI, more can be found here.
To run the following environment variables should be set first:
export RESOURCE_GROUP="<resource-group>"
export VNET_NAME="<vnet-name>"
export SP_APP_ID="<service-principal-app/client-id>"
export SP_SECRET="<service-pricipal-secret"
export STORAGE_ACCOUNT="<storage-account-name>"
export ACR="<azure-container-registry-name>"
In the /deploy/
directory run:
$ ./deployinfra.sh
This will create the following resources:
- A Resource Group
- A VNET
- A Subnet on said VNET
- Azure Kubernetes Cluster
- Enables Virtual Nodes on AKS
- A Managed Service Identitiy (MSI)
- A Storage Account
- A Queue
- An Azure Container Registry
- Assigns roles to Service Principals and Managed Service Identity
NOTE: Role assignment may take a few minutes to propogate, you may need to run this script a couple of times
This builds and pushes the Queue Consumer to the Azure Container Registry
$ ./dockerpush.sh
This will generate kubernetes yamls using helm template
. This removes the
requirement of Tiller. To run this:
$ ./deploytokubernetes
In the Azure portal navigate to your Storage Account with the queue you created.
Click +
to add a message to the queue.
--or--
$ az storage message get -q "queue" --auth-mode "login" --account-name $STORAGE_ACCOUNT
To destroy all running items on Kubernetes, run:
$ ./prepareforredeploy.sh
Note this may need to be run multiple times as there are some issues with KEDA crds and deleting. Run this script twice to ensure crds can be patched and deleted.
This is a simple python container that processes 1 message from a Queue at a time. KEDA will spin up 1 instance of the Queue Consumer per queue message. This should be replaced with a more robust message processor and is only used as a PoC.
This uses Managed Service Identities to retrieve PaaS resources without any secrets.
Two environment variables are required for this to run:
STORAGE_ACCOUNT
, the name of your Azure Storage AccountQUEUE_NAME
, the name of your Azure Queue.
Code can be found here
- Refactor deployinfra.sh
- Improve documentation
Pull requests and issues are appreciated.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.