From 9f1e8688e47d635521ca263930bfd70045f42b5e Mon Sep 17 00:00:00 2001 From: Nigel Date: Sun, 14 Apr 2024 19:51:15 +0200 Subject: [PATCH] Starting the machine setup --- .gitignore | 1 + README.md | 26 ++++++++++++++++++++++++++ Vagrantfile | 41 +++++++++++++++++++++++++++++++++++++++++ controlplane.yml | 12 ++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 Vagrantfile create mode 100644 controlplane.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a977916 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vagrant/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..08eb51c --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# K8S in Virtualbox +Vagrant_logo +Virtualbox_logo +Ansible_logo +K8S_logo + + +## Toolset +- Virtualbox +- Ansible +- Vagrant + + +## Vagrant and Ansible resources: +https://developer.hashicorp.com/vagrant/docs/providers/virtualbox/networking +https://friendsofvagrant.github.io/v1/docs/multivm.html +https://developer.hashicorp.com/vagrant/docs/provisioning/Ansible +https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html +https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_repository_module.html + + + +## Installation instructions source: +https://levelup.gitconnected.com/a-step-by-step-guide-to-setup-kubernetes-cluster-in-virtualbox-ubuntu-20-04-image-91d4510bbf1c\?gi\=a8d7cb695930 + +https://medium.com/@mojabi.rafi/create-a-kubernetes-cluster-using-virtualbox-and-without-vagrant-90a14d791617 diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..fbf208b --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,41 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "generic/debian12" + config.vm.network "private_network", ip: "192.168.50.4", virtualbox__intnet: true + + config.vm.define :control_plane do |machine| + machine.vm.provider "virtualbox" do |v| + v.name = "controlPlaneK8S" + v.memory = 1024 + v.cpus = 2 + v.customize ["modifyvm", :id, "--groups", "/K8S"] + end + end + + config.vm.define :node1 do |machine| + machine.vm.provider "virtualbox" do |v| + v.name = "Node1K8S" + v.memory = 1024 + v.cpus = 2 + v.customize ["modifyvm", :id, "--groups", "/K8S"] + end + end + config.vm.define :node2 do |machine| + machine.vm.provider "virtualbox" do |v| + v.name = "Node2K8S" + v.memory = 1024 + v.cpus = 2 + v.customize ["modifyvm", :id, "--groups", "/K8S"] + end + end + config.vm.define :node3 do |machine| + machine.vm.provider "virtualbox" do |v| + v.name = "Node3K8s" + v.memory = 1024 + v.cpus = 2 + v.customize ["modifyvm", :id, "--groups", "/K8S"] + end + end +end diff --git a/controlplane.yml b/controlplane.yml new file mode 100644 index 0000000..c91e7b7 --- /dev/null +++ b/controlplane.yml @@ -0,0 +1,12 @@ +--- +- Tasks: + - name: Add APT Repositories + become: true + ansible.builtin.apt_repository: + repo: " + state: present + + - name: Runtime interface installation + become: true + ansible.builtin.apt: + name: