35 lines
1.1 KiB
Bash
Executable File
35 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
set -u
|
|
|
|
SCRIPT_DIR=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")")
|
|
source ${SCRIPT_DIR}/helper.sh
|
|
|
|
set_remote $1
|
|
|
|
# Setup k3s
|
|
ARGS="--tls-san=$VIP --disable servicelb --disable traefik --etcd-s3 --etcd-s3-endpoint=s3.us-west-002.backblazeb2.com --etcd-s3-bucket=titan-k3s-backup --etcd-s3-folder=testing --cluster-init"
|
|
ssh -t $REMOTE "curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_EXEC=\"server $ARGS\" sh -"
|
|
add_b2_key_to_k3s_env
|
|
start_k3s
|
|
|
|
# Copy over kubeconfig
|
|
ssh -t $REMOTE "sudo -S cat /etc/rancher/k3s/k3s.yaml" > ~/.kube/config
|
|
|
|
# Update up to correct ip
|
|
sed -i -e "s/127.0.0.1/$REMOTE/" ~/.kube/config
|
|
|
|
# Add sops secret to the cluster
|
|
kubectl apply -f namespace.yaml
|
|
sops decrypt ./sops-gpg.yaml | kubectl apply -f -
|
|
|
|
# Bootstrap flux on the node
|
|
flux bootstrap git --url ssh://git@huizinga.dev/Dreaded_X/flux-infra --branch=master --path=clusters/titan.lan.huizinga.dev --components source-controller,kustomize-controller,helm-controller
|
|
|
|
# Update the ip to the control plane virtual ip
|
|
sed -i -e "s/$REMOTE/$VIP/" ~/.kube/config
|
|
|
|
sleep 5
|
|
|
|
kubectl get nodes
|