k8s/k3d-cluster.sh
#!/bin/bash
# Create (or recreate) the local k3d cluster for WAHA on Colima.
# WAHA ends up on 127.0.0.1:${WAHA_PORT:-3100} (3000 is often taken, e.g. by Open WebUI).
set -euo pipefail
PORT="${WAHA_PORT:-3100}"
unset DOCKER_DEFAULT_PLATFORM # a global linux/amd64 breaks arm64 pulls
docker context use colima >/dev/null
[[ "$(docker info --format '{{.Architecture}}')" == "aarch64" || "$(uname -m)" != "arm64" ]] \
|| { echo "Colima VM is not arm64. Recreate: colima delete && colima start --arch aarch64 --vm-type vz"; exit 1; }
k3d cluster list | grep -q '^ts03 ' && { echo "cluster ts03 already exists"; exit 0; }
k3d cluster create ts03 -p "127.0.0.1:${PORT}:30000@server:0"
kubectl get nodes -o jsonpath='{.items[0].status.nodeInfo.architecture}{"\n"}'
Questions or corrections: [email protected]