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
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
--generate-ssh-keys
az aks get-credentials --resource-group globalazure24 --name spinkube-aks
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 https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.crds.yaml
# Add Helm repositories jetstack and KWasm
helm repo add jetstack https://charts.jetstack.io
helm repo add kwasm http://kwasm.sh/kwasm-operator
# 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 \
--set kwasmOperator.installerImage=ghcr.io/spinkube/containerd-shim-spin/node-installer:v0.13.1
# For demo, making all nodes can run wasm workload, kwasm-operator will create containerd-shim-spin on these nodes
kubectl annotate node --all kwasm.sh/kwasm-node=true
kubectl apply -f https://github.com/spinkube/spin-operator/releases/download/v0.1.0/spin-operator.runtime-class.yaml
kubectl apply -f https://github.com/spinkube/spin-operator/releases/download/v0.1.0/spin-operator.crds.yaml
kubectl apply -f https://github.com/spinkube/spin-operator/releases/download/v0.1.0/spin-operator.shim-executor.yaml
Step 3: Build and run SpinApp on AKS
git clone https://github.com/thangchung/coffeeshop-on-spinkube
git checkout feat/global-azure-2024
cd coffeeshop-on-spinkube/product-api
export IMAGE_NAME=ttl.sh/coffeeshop-product-api-spin:24h
spin registry push --build $IMAGE_NAME
spin kube scaffold -f $IMAGE_NAME > app.yaml
kubectl apply -f app.yaml
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
}
]
Happy hacking SpinKube on AKS!
Top comments (2)
This is great, thanks for putting it together, @thangchung !
FYI I tried cloning the repo from github.com/thangchung/coffeeshop-o... and it's private.
Hi Radu. Thanks because you like it.
Sorry, I forgot to do it. It's public now and I also update the post.