mirror of
https://gitlab.kube.huskypup.net/Scooby/Homelabv4.git
synced 2026-08-20 23:16:49 +00:00
Initial commit
This commit is contained in:
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
export TALOSCONFIG=/home/scooby/Talosv3/talosconfig
|
||||
|
||||
echo "=== Talos iSCSI Bootstrap Script ==="
|
||||
echo ""
|
||||
echo "This script configures Talos nodes for Longhorn by:"
|
||||
echo "1. Enabling control plane scheduling"
|
||||
echo "2. Adding Longhorn volume mounts"
|
||||
echo "3. Upgrading to factory image with iscsi-tools"
|
||||
echo ""
|
||||
|
||||
# Step 1: Enable scheduling on control planes
|
||||
echo "Step 1/4: Enabling scheduling on control planes..."
|
||||
cat > /tmp/allow-scheduling.yaml <<EOF
|
||||
cluster:
|
||||
allowSchedulingOnControlPlanes: true
|
||||
EOF
|
||||
|
||||
talosctl patch mc -p @/tmp/allow-scheduling.yaml --nodes 172.28.101.41,172.28.101.42,172.28.101.43,172.28.101.44
|
||||
echo "✅ Scheduling enabled"
|
||||
|
||||
# Step 2: Add Longhorn volume mounts
|
||||
echo ""
|
||||
echo "Step 2/4: Adding Longhorn volume mounts..."
|
||||
cat > /tmp/longhorn-volume.patch.yaml <<EOF
|
||||
machine:
|
||||
kubelet:
|
||||
extraMounts:
|
||||
- destination: /var/lib/longhorn
|
||||
type: bind
|
||||
source: /var/lib/longhorn
|
||||
options:
|
||||
- bind
|
||||
- rshared
|
||||
- rw
|
||||
EOF
|
||||
|
||||
talosctl patch mc --nodes 172.28.101.41,172.28.101.42,172.28.101.43,172.28.101.44 --patch @/tmp/longhorn-volume.patch.yaml
|
||||
echo "✅ Longhorn mounts configured"
|
||||
|
||||
# Step 3: Remove old extension references
|
||||
echo ""
|
||||
echo "Step 3/4: Removing deprecated extension references..."
|
||||
cat > /tmp/clear-extensions.yaml <<EOF
|
||||
- op: remove
|
||||
path: /machine/install/extensions
|
||||
EOF
|
||||
|
||||
talosctl patch mc --patch @/tmp/clear-extensions.yaml --nodes 172.28.101.41,172.28.101.42,172.28.101.43,172.28.101.44 2>/dev/null || true
|
||||
echo "✅ Old extensions removed"
|
||||
|
||||
# Step 4: Upgrade to factory image with iscsi-tools
|
||||
echo ""
|
||||
echo "Step 4/4: Upgrading to Talos with iscsi-tools (this will take several minutes)..."
|
||||
echo "Factory image includes: iscsi-tools, util-linux-tools"
|
||||
echo ""
|
||||
|
||||
SCHEMATIC_ID="613e1592b2da41ae5e265e8789429f22e121aab91cb4deb6bc3c0b6262961245"
|
||||
TALOS_VERSION="v1.9.4"
|
||||
|
||||
echo "Upgrading nodes one at a time to: factory.talos.dev/installer/$SCHEMATIC_ID:$TALOS_VERSION"
|
||||
|
||||
for node in 172.28.101.41 172.28.101.42 172.28.101.43 172.28.101.44; do
|
||||
echo ""
|
||||
echo "Upgrading $node..."
|
||||
talosctl upgrade --nodes $node \
|
||||
--image factory.talos.dev/installer/$SCHEMATIC_ID:$TALOS_VERSION \
|
||||
--preserve --wait --timeout 10m || echo "⚠️ Node $node upgrade encountered issues, continuing..."
|
||||
|
||||
echo "Waiting 30s for node to stabilize..."
|
||||
sleep 30
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=== Waiting for all nodes to be Ready ==="
|
||||
kubectl wait --for=condition=Ready nodes --all --timeout=300s
|
||||
|
||||
echo ""
|
||||
echo "=== Verifying iSCSI installation ==="
|
||||
talosctl get extensions -n 172.28.101.41
|
||||
|
||||
echo ""
|
||||
echo "✅ Talos iSCSI bootstrap complete!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " cd /home/scooby/Homelabv5"
|
||||
echo " ./scripts/bootstrap-crds.sh"
|
||||
echo " helmfile apply"
|
||||
Reference in New Issue
Block a user