exo01 done
This commit is contained in:
parent
f01f01e9c9
commit
47fba0762f
13
Vagrantfile
vendored
13
Vagrantfile
vendored
@ -1,15 +1,14 @@
|
|||||||
Vagrant.configure(2) do |config|
|
Vagrant.configure(2) do |config|
|
||||||
# [...]
|
|
||||||
config.vm.box = "hashicorp/bionic64"
|
config.vm.box = "hashicorp/bionic64"
|
||||||
config.vm.define "apommierS" do |control|
|
config.vm.define "apommierS" do |control|
|
||||||
control.vm.hostname = "apommierS"
|
control.vm.hostname = "apommierS"
|
||||||
control.vm.network "private_network", ip: "192.168.56.110"
|
control.vm.network "private_network", ip: "192.168.56.110"
|
||||||
control.vm.provider "virtualbox" do |v|
|
control.vm.provider "virtualbox" do |v|
|
||||||
v.name = "apommierS"
|
v.name = "apommierS"
|
||||||
v.memory = "512"
|
v.memory = "2048"
|
||||||
v.cpus = 1
|
v.cpus = 2
|
||||||
end
|
end
|
||||||
# [...]
|
control.vm.provision "shell", path: "k3s-master.sh"
|
||||||
end
|
end
|
||||||
|
|
||||||
# config.vm.provision "shell", inline: ""
|
# config.vm.provision "shell", inline: ""
|
||||||
@ -21,10 +20,10 @@ Vagrant.configure(2) do |config|
|
|||||||
control.vm.network "private_network", ip: "192.168.56.111"
|
control.vm.network "private_network", ip: "192.168.56.111"
|
||||||
control.vm.provider "virtualbox" do |v|
|
control.vm.provider "virtualbox" do |v|
|
||||||
v.name = "apommierSW"
|
v.name = "apommierSW"
|
||||||
v.memory = "512"
|
v.memory = "2048"
|
||||||
v.cpus = 1
|
v.cpus = 2
|
||||||
end
|
end
|
||||||
# [...]
|
control.vm.provision "shell", path: "k3s-worker.sh"
|
||||||
end
|
end
|
||||||
|
|
||||||
# config.vm.provision "shell", inline: <<-SHELL
|
# config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
|||||||
17
k3s-master.sh
Normal file
17
k3s-master.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/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
|
||||||
9
k3s-worker.sh
Normal file
9
k3s-worker.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
NODE_IP="192.168.56.111"
|
||||||
|
|
||||||
|
# Get the token from the shared folder
|
||||||
|
TOKEN=$(cat /vagrant/token)
|
||||||
|
|
||||||
|
# Install K3s agent (worker) and join the master node
|
||||||
|
curl -sfL https://get.k3s.io | K3S_URL=https://192.168.56.110:6443 K3S_TOKEN=$TOKEN sh -s - --node-ip=$NODE_IP
|
||||||
Loading…
Reference in New Issue
Block a user