Skip to content

Commit

Permalink
Merge pull request #64 from Yolean/multipass-local-cluster-restore
Browse files Browse the repository at this point in the history
Multipass local cluster restore
  • Loading branch information
solsson authored Dec 13, 2024
2 parents 9aa2f5f + b8cc82e commit b2eb352
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions bin/y-cluster-provision-k3s-multipass
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ then
echo "Y-stack appears to be running already" && exit
fi

multipass launch -n "$VM_NAME" $VM_RESOURCES
# "jammy 22.04.." is currently the version our nodes run. Remove "jammy" to get the latest LTS
multipass launch jammy -n "$VM_NAME" $VM_RESOURCES

# https://medium.com/@mattiaperi/kubernetes-cluster-with-k3s-and-multipass-7532361affa3
K3S_NODEIP_MASTER="$(multipass info $VM_NAME | grep "IPv4" | awk -F' ' '{print $2}')"
Expand All @@ -36,8 +37,6 @@ multipass exec "$VM_NAME" -- sudo cat /etc/rancher/k3s/k3s.yaml \

KUBECONFIG="$KUBECONFIG.tmp" kubectl config rename-context default $CONTEXTNAME

KUBECONFIG="$KUBECONFIG.tmp" kubectl -n kube-system apply -f $YSTACK_HOME/emulation/binfmt-daemonset.yaml

KUBECONFIG="$KUBECONFIG.tmp" y-cluster-assert-install --context=$CONTEXTNAME

# This list of bases also exists in ../k3s/docker-ystack-proxy/Dockerfile
Expand All @@ -46,13 +45,27 @@ for base in \
10-minio \
20-builds-registry \
21-prod-registry \
30-y-assert-support \
22-node-update-hosts \
30-monitoring-nodeport \
40-buildkit; do \
basepath="$YSTACK_HOME/k3s/$base/"
echo "# Applying $basepath ..."
KUBECONFIG="$KUBECONFIG.tmp" kubectl --context=$CONTEXTNAME apply -k $basepath
done

[ "$MONITORING_ENABLE" != "true" ] || for base in \
namespace \
prometheus-operator \
prometheus-now \
alertmanager-main \
kube-state-metrics-now \
node-exporter-now \
; do \
basepath="$YSTACK_HOME/monitoring/$base/"
echo "# Applying $basepath ..."
k apply --server-side=true -k $basepath
done

KUBECONFIG="$KUBECONFIG.tmp" kubectl --context=$CONTEXTNAME -n ystack apply -k $YSTACK_HOME/registry/containerd-config/

y-kubeconfig-import "$KUBECONFIG.tmp"
Expand Down
2 changes: 1 addition & 1 deletion bin/y-k3s-install
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export K3S_NODE_NAME=ystack-master
export INSTALL_K3S_EXEC="--kubelet-arg=address=0.0.0.0 ${INSTALL_K3S_EXEC}"

INSTALLER_REVISION=bd04941a294793ec92e8703d5e5da14107902e88
export INSTALL_K3S_VERSION=v1.27.6+k3s1
export INSTALL_K3S_VERSION=v1.30.5+k3s1
curl -sfL https://github.com/k3s-io/k3s/raw/$INSTALLER_REVISION/install.sh | sh -

service k3s start
Expand Down

0 comments on commit b2eb352

Please sign in to comment.