Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pmonllor/k3s-vagrant-virtualbox
Local multi-node Kubernetes cluster deployed with Ansible, Vagrant & VirtualBox, works in both Windows & Linux
https://github.com/pmonllor/k3s-vagrant-virtualbox
ansible k3s kubernetes vagrant virtualbox
Last synced: 2 months ago
JSON representation
Local multi-node Kubernetes cluster deployed with Ansible, Vagrant & VirtualBox, works in both Windows & Linux
- Host: GitHub
- URL: https://github.com/pmonllor/k3s-vagrant-virtualbox
- Owner: pmonllor
- Created: 2024-07-29T15:38:10.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-29T16:43:12.000Z (5 months ago)
- Last Synced: 2024-10-01T06:40:47.857Z (3 months ago)
- Topics: ansible, k3s, kubernetes, vagrant, virtualbox
- Language: Jinja
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# k3s-vagrant-virtualbox
The purpose of this repo is to provide a simple way to launch a multi-node Kubernetes cluster for local development, both in Windows with WSL2 & natively on Linux# Index
- [k3s-vagrant-virtualbox](#k3s-vagrant-virtualbox)
- [Index](#index)
- [Infrastructure configuration](#infrastructure-configuration)
- [Windows considerations](#windows-considerations)
- [Launch](#launch)
- [Windows](#windows)
- [Linux](#linux)
- [Kubeconfig](#kubeconfig)
- [Tech stack](#tech-stack)# Infrastructure configuration
- Clone this repo- Edit ```vars/infra.yml``` as prefered
```bash
---
# VMs hostnames (FQDN) - Example: pier.terrapin.ch
master_server: master.juna
worker_node_1: worker1.juna
worker_node_2: worker2.juna# IP addreses
master_server_ip: "10.0.1.10"
worker_node_1_ip: "10.0.1.20"
worker_node_2_ip: "10.0.1.30"# Disk sizes
master_server_disk: "100GB"
worker_node_1_disk: "80GB"
worker_node_2_disk: "80GB"# Hardware - RAM specified in MB
master_server_cpus: "4"
master_server_ram: 8192worker_nodes_cpus: "2"
worker_nodes_ram: 4096# OS - Ubuntu 24.04
vagrant_box: "bento/ubuntu-24.04"# VirtualBox for Ubuntu 22.04 - https://www.virtualbox.org/wiki/Linux_Downloads
# Will be installed on the host that launches the playbooks (localhost by default)
vbox_ubuntu: "https://download.virtualbox.org/virtualbox/7.0.20/virtualbox-7.0_7.0.20-163906~Ubuntu~noble_amd64.deb"
```# Windows considerations
- Install on your windows machine: [Vagrant](https://developer.hashicorp.com/vagrant/downloads), [VirtualBox](https://www.virtualbox.org/wiki/Downloads) & [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install)
- Create Ubuntu distribution: `wsl --install -d ubuntu`
- Convert distribution to use WSL2: `wsl --set-version ubuntu 2`
- Enter the machine `wsl -d Ubuntu`
- Install Ansible `python3 -m pip install ansible`# Launch
## Windows
**Inside WSL**
```bash
ansible-playbook deploy_infra_windows.yml
```
**Outside WSL**
```bash
vagrant up
```
**Inside WSL - After vagrant up finishes**
```bash
ansible-playbook setup_k3s.yml
```
## Linux
```bash
ansible-playbook deploy_infra.yml
```
```bash
ansible-playbook setup_k3s.yml
```# Kubeconfig
Your kubeconfig file will be in ~/.kube/k3s.yaml to use it you can set the **KUBECONFIG** environment variable with this command
```bash
export KUBECONFIG="~/.kube/k3s.yaml"
```Verify you have access to the cluster
```bash
kubectl get nodes
```And you're all set
# Tech stack
Logo
Name
Description
K3s
Lightweight Kubernetes
Ansible
Automate VM provisioning and configuration
Vagrant
Automate VM creation in Virtualbox
VirtualBox
Virtualization
WSL2
Windows Subsystem for Linux
Ubuntu Server
Base OS for VMs