DEV Community

Thang Chung
Thang Chung

Posted on

How to build and run SpinApp on Azure Kubernetes Services (AKS) with SpinKube in 3 steps

This tutorial guides you to run SpinApp on AKS with SpinKube in just 3 simple steps.

Let's get started.

Step 1: Create AKS cluster

az login --use-device-code
az account set --subscription <your subscription id>
az account show
Enter fullscreen mode Exit fullscreen mode

Now you are ready to create the AKS cluster as below:

az group create --name globalazure24 --location southeastasia

az aks create \
  --resource-group globalazure24 \
  --name spinkube-aks \
  --node-count 1

az aks get-credentials --resource-group globalazure24 --name spinkube-aks
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Spinkube on AKS

# SpinKube needs cert-manager for provisioning and managing TLS certificates that are used by the admission webhook system of the Spin Operator
kubectl apply -f

# Add Helm repositories jetstack and KWasm
helm repo add jetstack
helm repo add kwasm

# Update Helm repositories
helm repo update

# Install cert-manager using Helm
helm install \
  cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace \
  --version v1.14.4

# Install KWasm operator
helm install \
  kwasm-operator kwasm/kwasm-operator \
  --namespace kwasm \
  --create-namespace \

# For demo, making all nodes can run wasm workload, kwasm-operator will create containerd-shim-spin on these nodes 
kubectl annotate node --all

kubectl apply -f

kubectl apply -f

kubectl apply -f
Enter fullscreen mode Exit fullscreen mode

Step 3: Build and run SpinApp on AKS

git clone

git checkout feat/global-azure-2024

cd coffeeshop-on-spinkube/product-api


spin registry push --build $IMAGE_NAME

spin kube scaffold -f $IMAGE_NAME > app.yaml

kubectl apply -f app.yaml
Enter fullscreen mode Exit fullscreen mode

Now you're ready to curl:

curl http://localhost/v1-get-items-by-types/1,2,3 | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   280    0   280    0     0   2788      0 --:--:-- --:--:-- --:--:--  2800
    "image": "img/COFFEE_BLACK.png",
    "item_type": "CoffeeBlack",
    "name": "COFFEE_BLACK",
    "price": 3
    "image": "img/COFFEE_WITH_ROOM.png",
    "item_type": "CoffeeWithRoom",
    "name": "COFFEE_WITH_ROOM",
    "price": 3
    "image": "img/ESPRESSO.png",
    "item_type": "Espresso",
    "name": "ESPRESSO",
    "price": 3.5
Enter fullscreen mode Exit fullscreen mode

Happy hacking SpinKube on AKS!

Top comments (2)

matei_radu profile image
Radu Matei

This is great, thanks for putting it together, @thangchung !

FYI I tried cloning the repo from and it's private.

thangchung profile image
Thang Chung

Hi Radu. Thanks because you like it.

Sorry, I forgot to do it. It's public now and I also update the post.