Serverless Kubernetes on Azure Container Instances
This repo contains all the code needed to create a "virtual cluster" on top of Azure Container Instances. This isn't production-grade - think of it as a fun experiment and a reference on what's possible using Resource Manager Templates and ACI.
Read more here: https://www.noelbundick.com/2018/01/22/Frankenetes-Running-the-Kubernetes-control-plane-on-Azure-Container-Instances/
- Create a Service Principal for virtual-kubelet
# Create a service principal
# Tip: the following terms are synonymous: clientId<->appId, clientSecret<->password
az ad sp create-for-rbac -n frankenetes --skip-assignment
- Create a virtual Kubernetes cluster
az group create -n frankenetes -l eastus
az group deployment create -g frankenetes --template-file ./azuredeploy.json --parameters servicePrincipalClientId=<clientId> servicePrincipalClientSecret=<clientSecret> servicePrincipalObjectId=<objectId> --query 'properties.outputs.kubeconfig.value' -o tsv
# Download the kubeconfig from Azure Files
# The exact command to run is an output of the deployment
az storage file download --account-name <storageAccountName> -s kubeconfigs -p admin.kubeconfig
export KUBECONFIG=admin.kubeconfig
- Run something!
Frankenetes runs two virtual-kubelets, so it's a hybrid-OS cluster!
You can run Linux containers:
# Run nginx
kubectl run nginx --image=nginx --port 80
# Hit the deployed pod
NGINX_IP=`kubectl get pod -l run=nginx -o=jsonpath='{.items[0].status.podIP}'`
curl $NGINX_IP
Or Windows containers:
# Run IIS
k run iis --image=microsoft/iis:nanoserver-sac2016 --port=80
# Hit the deployed pod
IIS_IP=`kubectl get pod -l run=iis -o=jsonpath='{.items[0].status.podIP}'`
curl $IIS_IP
To remove the cluster completely, delete the resource groups:
az group delete -n frankenetes -y --no-wait
To stop all compute, but leave your cluster configuration intact, delete just your Azure Container Instances:
for aci in `az container list -g frankenetes --query "[].name" -o tsv`; do az container delete -n $aci -g frankenetes -y; done