Ne00n / woodKubernetes

LXD wood cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

woodKubernetes

Work in Progress

Idea

  • High Availability of LXD containers without LXD cluster and/or CephFS

Why

  • Kubernetes is way to complex for my use case
  • LXD Cluster needs CephFS storage backend + won't work well on higher latency

Software

  • LXD for running the containers
  • rqlite to store containers info/leader choice

Features

  • High Availability
  • Port Forwarding
  • ACME Support (LE)

Requirements

  • 3+ Nodes with Ubuntu 20.04 or Debian 10
  • Each node should have at least 1GB of Memory
  • Mesh VPN connecting them together (Tinc/VpnCloud/Wireguard)

Prepare
Rename servers.example.json to servers.json and fill it up

Setup

  1. Deploy LXD on all Nodes and init
    By default a loop file is used with lvm
python3 wood.py lxd
  1. Deploy rqlite on all Nodes
    Check if the version is up to date
python3 wood.py rqlite

Check the rqlite cluster status:

curl rqlite:4003/nodes?pretty
  1. Deploy woodKubernetes
python3 wood.py wood
  1. SSH into any machine and Initialize the Database
su woodKubernetes -c "cd /home/woodKubernetes/woodKubernetes/ && python3 cli.py init"
  1. Deploy the primary service
python3 wood.py service
  1. Deploy the first container

Before you deploy, you should preload the os images you need.
This results in faster deploy times and don't affect you if the image server is down or slow.

nginx example

python3 cli.py machine add one debian/buster 256 80:80,443:443 \
"apt-get install nginx -y"

znc example

python3 cli.py machine add one debian/buster 256 1025:1025 \
"apt-get install wget znc -y && wget -qO - https://gist.githubusercontent.com/Ne00n/1fa5851bb86927e68ac82015da5a6744/raw/3232ac5c2350fdf5e2e17996752d68aa9142fa7f/znc%2520test%2520deploy | bash"

If you want no port forwarding use 0 instead

preload
preload os templates

python3 wood.py preload

Update

python3 wood.py update

About

LXD wood cluster

License:MIT License


Languages

Language:Python 100.0%