diff options
author | makefunstuff <[email protected]> | 2024-06-30 17:58:04 +0200 |
---|---|---|
committer | makefunstuff <[email protected]> | 2024-06-30 17:58:04 +0200 |
commit | 78a3a7b751b5042b775dfbf3376362ce9729e5bb (patch) | |
tree | 802515693d3039df5f3f84729b3ec4ee61eea3af | |
parent | cbfab9c28fb56ba9c13a574b0e69c8adba5e61c8 (diff) | |
download | k3s-lab-78a3a7b751b5042b775dfbf3376362ce9729e5bb.tar.gz |
more todos
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | vagrant/.vagrant/rgloader/loader.rb | 12 | ||||
-rw-r--r-- | vagrant/Vagrantfile.gpu | 59 | ||||
-rw-r--r-- | vagrant/Vagrantfile.regular | 27 |
4 files changed, 102 insertions, 2 deletions
diff --git a/README.md b/README.md index 9d21b36..0bc6699 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,7 @@ Different experiments with home k3s clusterk - [x] setup argocd - [x] create helm chart for grafana stack with otel elastic and prometheus - [x] create helm chart with poc nginx -- [ ] configure labels for prometheus -- [ ] configure filebeat to properly discover container logs +- [x] configure labels for prometheus +- [x] configure filebeat to properly discover container logs +- [ ] add bare metal agents +- [ ] add gpu nvidia vwms to run some "ai stuff" in cluster diff --git a/vagrant/.vagrant/rgloader/loader.rb b/vagrant/.vagrant/rgloader/loader.rb new file mode 100644 index 0000000..b6c81bf --- /dev/null +++ b/vagrant/.vagrant/rgloader/loader.rb @@ -0,0 +1,12 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +# This file loads the proper rgloader/loader.rb file that comes packaged +# with Vagrant so that encoded files can properly run with Vagrant. + +if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"] + require File.expand_path( + "rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]) +else + raise "Encoded files can't be read outside of the Vagrant installer." +end diff --git a/vagrant/Vagrantfile.gpu b/vagrant/Vagrantfile.gpu new file mode 100644 index 0000000..70c4e55 --- /dev/null +++ b/vagrant/Vagrantfile.gpu @@ -0,0 +1,59 @@ +Vagrant.configure("2") do |config| + config.vm.box = "ubuntu/bionic64" # Or any other preferred Linux distribution + + # Configure VM hardware + config.vm.provider "virtualbox" do |vb| + vb.memory = "32768" + vb.cpus = 4 + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.customize ["modifyvm", :id, "--vram", "10240"] # Set VRAM to 10GB + vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"] + vb.customize ["modifyvm", :id, "--accelerate3d", "on"] + end + + # Provisioning script + config.vm.provision "shell", inline: <<-SHELL + # Update and install prerequisites + sudo apt-get update + sudo apt-get install -y curl gnupg build-essential + + # Add NVIDIA package repositories + distribution=$(. /etc/os-release;echo $ID$VERSION_ID) + sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/7fa2af80.pub + echo "deb https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list + echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/$distribution/x86_64 /" | sudo tee /etc/apt/sources.list.d/nvidia-ml.list + + # Install NVIDIA drivers and CUDA toolkit + sudo apt-get update + sudo apt-get install -y cuda + + # Add CUDA to the PATH + echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> ~/.bashrc + echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc + source ~/.bashrc + + # Install Tailscale + curl -fsSL https://tailscale.com/install.sh | sh + + # Install K3s + curl -sfL https://get.k3s.io | sh - + + # Add your SSH public key (replace with your actual public key) + mkdir -p ~/.ssh + echo "" >> ~/.ssh/authorized_keys + chmod 600 ~/.ssh/authorized_keys + + # Restart SSH service + sudo service ssh restart + + # Install NVIDIA container toolkit + curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - + distribution=$(. /etc/os-release;echo $ID$VERSION_ID) + curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list + sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit + + # Restart Docker to load the NVIDIA runtime + sudo systemctl restart docker + SHELL +end + diff --git a/vagrant/Vagrantfile.regular b/vagrant/Vagrantfile.regular new file mode 100644 index 0000000..79b3345 --- /dev/null +++ b/vagrant/Vagrantfile.regular @@ -0,0 +1,27 @@ +Vagrant.configure("2") do |config| + config.vm.box = "ubuntu/bionic64" + + config.vm.provider "virtualbox" do |vb| + vb.memory = "16384" + vb.cpus = 4 + end + + config.vm.provision "shell", inline: <<-SHELL + # Update and install prerequisites + apt-get update + apt-get install -y curl gnupg2 apt-transport-https software-properties-common + + # Install Tailscale + curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/bionic.gpg | apt-key add - + curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/bionic.list | tee /etc/apt/sources.list.d/tailscale.list + apt-get update + apt-get install -y tailscale + + # Start and authenticate Tailscale + systemctl enable --now tailscaled + + # Install k3sup + curl -sLS https://get.k3sup.dev | sh + mv k3sup /usr/local/bin/k3sup + SHELL +end |