-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathcreate.sh
executable file
·28 lines (24 loc) · 970 Bytes
/
create.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
# Creates three k3d clusters: dev, east, & west.
#
set -eu
set -x
export ORG_DOMAIN="${ORG_DOMAIN:-k3d.example.com}"
port=6440
for cluster in dev east west ; do
if k3d cluster get "$cluster" >/dev/null 2>&1 ; then
echo "Already exists: $cluster" >&2
else
k3d cluster create "$cluster" \
--api-port="$((port++))" \
--network=multicluster-example \
--k3s-arg="--cluster-domain=$cluster.${ORG_DOMAIN}@server:*" \
--k3s-arg='--no-deploy=local-storage,metrics-server@server:*' \
--kubeconfig-update-default \
--kubeconfig-switch-context=false
fi
while [ $(kubectl --context="k3d-$cluster" get po -n kube-system -l k8s-app=kube-dns -o json |jq '.items | length') = "0" ]; do sleep 1 ; done
kubectl --context="k3d-$cluster" wait pod --for=condition=ready \
--namespace=kube-system --selector=k8s-app=kube-dns \
--timeout=1m
done