Inception-of-Things/p1/scripts/k3s-master.sh
2025-02-17 14:30:10 +01:00

17 lines
499 B
Bash

#!/bin/bash
NODE_IP="192.168.56.110"
# Install K3s on the master node
curl -sfL https://get.k3s.io | sh -s - --node-ip=$NODE_IP
# Make sure kubectl is set up for the vagrant user
sudo mkdir -p /home/vagrant/.kube
sudo cp /etc/rancher/k3s/k3s.yaml /home/vagrant/.kube/config
sudo chown -R vagrant:vagrant /home/vagrant/.kube/config
# Get the token for the worker nodes
TOKEN=$(sudo cat /var/lib/rancher/k3s/server/node-token)
# Store the token for the workers to use
echo $TOKEN > /vagrant/token