Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crisszkutnik/ansible-k8s-config-home-lab
Ansible configuration for my home lab k8s cluster
https://github.com/crisszkutnik/ansible-k8s-config-home-lab
ansible home-lab k8s kubernetes kubernetes-cluster raspberry-pi raspberrypi
Last synced: about 1 month ago
JSON representation
Ansible configuration for my home lab k8s cluster
- Host: GitHub
- URL: https://github.com/crisszkutnik/ansible-k8s-config-home-lab
- Owner: crisszkutnik
- Created: 2023-07-22T20:30:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-13T18:07:32.000Z (about 1 year ago)
- Last Synced: 2023-12-13T19:34:59.062Z (about 1 year ago)
- Topics: ansible, home-lab, k8s, kubernetes, kubernetes-cluster, raspberry-pi, raspberrypi
- Language: Jinja
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ansible config for Kubernetes home lab
Ansible config for my home lab that is set up with three Orange Pi 5. It sets up a Kubernetes cluster using k3s. It is made specifically for my setup, so it will most likely will not match yours, but feel free to modifiy it or use it as reference.
This config will change over time if I ever need to add some functionality or I need it to be more flexible.
It contains three Ansible playbooks that perform various tasks
## Prerequisites
First of all you have to create a SSH keypair and set it up in each of the hosts. You will have to add the public key of the keypair to the `authorized_keys` file of each host
## How to run
It is very easy. Just have Ansible installed and run
```bash
ansible-playbook
```# Playbooks
## update_sources
This playbook task is to replace the apt sources of the Orange Pi Ubuntu distro for the default Ubuntu ARM apt sources
### Variables
| Variable name | Default value | Description |
|-------------------------|---------------|------------------------------------------------------------------|
| ubuntu_version_codename | jammy | The codename of the Ubuntu version that the hosts have installed |## Netplan
It will modify the netplan of the hosts in order to set up a static local IP address. For this to work correctly you have to reserve those addresses in you router by setting them as reserved or removing them from the DHCP configuration
For this to work correctly you have to create a `host_map.ini` file that will map each host IP to the new IP. You also need to add the hosts to the `hosts.ini` file under the `netplan_hosts` group. Full example would like like thi:
This playbook has no variables.
```ini
# host_map.ini
[ip_map]
192.168.0.20=192.168.0.200
192.168.0.26=192.168.0.211
192.168.0.27=192.168.0.212
``````ini
# hosts.ini
[netplan_hosts]
[email protected]
[email protected]
[email protected]
```## configure_k3s
It will set up a Kubernetes cluster using K3S. This playbook can configure nodes and _*a single master node*_
Your `hosts.ini` should contain something as follows for this playbook to work:
```ini
[master]
@[nodes]
@
@[k3s_cluster:children]
master
nodes```
For example:
```ini
[master]
[email protected][nodes]
[email protected]
[email protected][k3s_cluster:children]
master
nodes
```### Variables
| Variable name | Default value | Description |
|-------------------|---------------------|------------------------------------------------------------------|
| master_ip | jammy | The codename of the Ubuntu version that the hosts have installed |
| extra_server_args | | Extra Kubernetes arguments used for the master node |
| extra_agent_args | | Extra Kubernetes arguments used for the nodes |
| ansible_user | | Non-root user that will be used to connect to the hosts |
| ansible_sudo_pass | | Sudo password of the hosts |