mirror of
https://github.com/ghndrx/starlane-router.git
synced 2026-02-10 06:45:01 +00:00
40 lines
1.1 KiB
Bash
40 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Requirements:
|
|
# - doctl installed and authenticated: `doctl auth init`
|
|
# - kubectl installed
|
|
# - DigitalOcean account with permissions
|
|
|
|
# Usage:
|
|
# ./scripts/doctl_create_cluster.sh my-a2a-cluster nyc1 s-1vcpu-2gb 1.29.1-do.0
|
|
# Defaults if not provided.
|
|
|
|
CLUSTER_NAME=${1:-a2a-cluster}
|
|
REGION=${2:-nyc1}
|
|
NODE_SIZE=${3:-s-1vcpu-2gb}
|
|
VERSION=${4:-1.29.1-do.0}
|
|
NODE_COUNT=${5:-1}
|
|
|
|
echo "Creating cluster: $CLUSTER_NAME in $REGION size=$NODE_SIZE nodes=$NODE_COUNT version=$VERSION"
|
|
|
|
doctl kubernetes cluster create "$CLUSTER_NAME" \
|
|
--region "$REGION" \
|
|
--version "$VERSION" \
|
|
--size "$NODE_SIZE" \
|
|
--count "$NODE_COUNT" \
|
|
--auto-upgrade=false \
|
|
--wait
|
|
|
|
# Fetch kubeconfig
|
|
mkdir -p "$HOME/.kube"
|
|
doctl kubernetes cluster kubeconfig save "$CLUSTER_NAME"
|
|
|
|
echo "Cluster created and kubeconfig saved. Current context:"
|
|
KUBECONTEXT=$(kubectl config current-context)
|
|
echo "$KUBECONTEXT"
|
|
|
|
echo "Optional: install nginx ingress controller"
|
|
cat <<EOF
|
|
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.1/deploy/static/provider/cloud/deploy.yaml
|
|
EOF |