_...with Ansible, Kubernetes and flex ⛵
- Get the k8s cluster up.
- Add some code to poke DHCP addresses into my router.
- Create an internal DNS server and share that.
-append 'autoinstall ds=nocloud-net;s=http://_gateway:3003/'
This repo contains everything I use to setup and manage my home network.
- An internal DNS server for *.home.andrewmccall.com
- k8s cluster that runs on all my machines.
- Everything is deployed as a docker container usually using labels to get it in the right place
- All machines are ubuntu servers
All dependencies are autmatically updated by Renovatebot. https://docs.renovatebot.com/modules/manager/
Renovate bot is cool af. It runs, checks project dependencies and creates a PR if there are newer ones. I automerge mine, which then upgrades them, deploys them and bam! My network is all the most recent version.
Since some of my tools are docker images I push to docker hub, it even deploys my own code as dependencies.
- Add MAC to DHCP list so we get consistent address
- Add DNS entry for IP so we have the right name
- Flash a base boot media, with basics as parameters.
- Manually run ansible or ping the hook.
The base image consists of
- andrewmccall user
- Added to suoders
- ssh pub key allowed to connect.
- ansible user
- Added to sudoers
- ssh pub key allowed to connect.
- Python to be able to run ansible
Once the base image is flashed to the install media (see /scripts) then the machine can be booted on the network. The DHCP server will assign the correct IP.
Once the ansible config is created the server can be started, on boot the server will try and download this repository and will execute the ansible config. This is usually pretty simple and mostly the same for most machines.
- Install k3s.
- Setup any hardware additional hardware that is required.
Here is a list of what runs on my network.
In the Rack! 1U DSL Modems x2 on custom printed 1U brackets. 1U Unify USG and 12V meanwell PSU in custom bracket and enclosure. 1U Patch Panel. 1U TPLink Switch. 4U betelguese home server.
Elsewhere on the network:
Host | Device | Storage | Purpose |
---|---|---|---|
betelgeuse.local | Raspberrt Pi 4 | 64GB SD | k8s master, octoprint |
Raspberry Pi Zero 2 | 64GB SD | Smart mirror | |
Raspberry Pi Zero | 16GB SDe | Gamer beds in boys rooms |
- Flash the image.
- Add entries to Ansible
- Label any nodes
System requirements - sops, age, yq,
- Install SOPS
- Intall age.
- Get the age key.txt and put it in
~/Library/Application\ Support/sops/age/keys.txt
This repo is heavily based on: https://github.com/Diaoul/home-ops