Migrate from k3s to k0s

This commit is contained in:
2025-03-22 20:20:48 +01:00
parent 63f0a76dd4
commit 202f8eccd6

View File

@@ -68,18 +68,23 @@ runcmd:
- su ${username} -c 'ssh-keygen -t ed25519 -f /home/${username}/.ssh/id_ed25519 -q -N "" ' - su ${username} -c 'ssh-keygen -t ed25519 -f /home/${username}/.ssh/id_ed25519 -q -N "" '
# SSH Passthrough for user git # SSH Passthrough for user git
- usermod -s /usr/local/bin/gitea-shell git - usermod -s /usr/local/bin/gitea-shell git
# k3s # Install kubectl
- curl -sfL https://get.k3s.io | sh -s - --disable=traefik - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
# Install k0s
- curl -sSLf https://get.k0s.sh | sudo sh
- k0s install controller --enable-worker
- systemctl enable --now k0scontroller
# Wait for k3s to be ready # Wait for k3s to be ready
- timeout 300 bash -c 'until kubectl get nodes; do sleep 5; done' - timeout 300 bash -c 'until k0s kubectl get nodes; do sleep 5; done'
# Set up kubeconfig for user # Set up kubeconfig for user
- mkdir -p /home/${username}/.kube - mkdir -p /home/${username}/.kube
- cp /etc/rancher/k3s/k3s.yaml /home/${username}/.kube/config - k0s kubeconfig admin > /home/${username}/.kube/config
- chown -R ${username}:${username} /home/${username}/.kube - chown -R ${username}:${username} /home/${username}/.kube
- chmod 600 /home/${username}/.kube/config - chmod 600 /home/${username}/.kube/config
# Set up kubeconfig for git # Set up kubeconfig for git
- mkdir -p /home/git/.kube - mkdir -p /home/git/.kube
- cp /etc/rancher/k3s/k3s.yaml /home/git/.kube/config - k0s kubeconfig admin > /home/git/.kube/config
- chown -R git:git /home/git/.kube - chown -R git:git /home/git/.kube
- chmod 600 /home/git/.kube/config - chmod 600 /home/git/.kube/config
# Dotfiles # Dotfiles
@@ -92,9 +97,4 @@ runcmd:
' '
# Install Flux # Install Flux
- curl -s https://fluxcd.io/install.sh | bash - curl -s https://fluxcd.io/install.sh | bash
# Install Velero
- curl -LO https://github.com/vmware-tanzu/velero/releases/download/v1.15.1/velero-v1.15.1-linux-amd64.tar.gz
- tar -xzf velero-v1.15.1-linux-amd64.tar.gz
- mv velero-v1.15.1-linux-amd64/velero /usr/local/bin/
- chmod +x /usr/local/bin/velero
final_message: "The system is finally up, after $UPTIME seconds" final_message: "The system is finally up, after $UPTIME seconds"