https://github.com/mosher-labs/ansible-node-setup
🚀 This repo provides Ansible playbooks and roles designed to configure and manage nodes for lightweight Kubernetes clusters using K3s. 🎯
https://github.com/mosher-labs/ansible-node-setup
ansible axes devops infrastructure-as-code mosher-labs reliability-engineering viking
Last synced: 3 months ago
JSON representation
🚀 This repo provides Ansible playbooks and roles designed to configure and manage nodes for lightweight Kubernetes clusters using K3s. 🎯
- Host: GitHub
- URL: https://github.com/mosher-labs/ansible-node-setup
- Owner: Mosher-Labs
- License: gpl-3.0
- Created: 2025-01-05T15:31:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-01-15T14:07:43.000Z (3 months ago)
- Last Synced: 2026-01-15T17:44:08.024Z (3 months ago)
- Topics: ansible, axes, devops, infrastructure-as-code, mosher-labs, reliability-engineering, viking
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# ansible-node-setup







## ⚙️ K8s Node Configuration with Ansible 🌐
Welcome to the K3s Kubernetes Node Setup repository! 🚀 This repo
provides Ansible playbooks and roles designed to configure and
manage nodes for lightweight Kubernetes clusters using K3s. 🎯
🌟 Key Features:
- 📜 Automated node provisioning and configuration for K3s clusters.
- 🔧 Support for common Kubernetes-ready optimizations and settings.
- 🖧 Seamless integration with existing Ansible workflows.
✨ Perfect for:
- Setting up development, testing, or production K3s clusters 🚀
- Managing scalable Kubernetes nodes with ease 🛠️
- Ensuring consistency and reproducibility across your infrastructure 🌍
- Clone the repo, run the playbooks, and get your cluster ready in no time! 🤝
## Usage
### 📦 Dependencies
```bash
mise install pipx
pipx install --incude-deps ansible
pipx ensurepath
```
### Configure individual node
After basic Ubuntu Server install:
```bash
ssh ubuntu-virtualbox
sudo adduser ansible
sudo usermod -aG sudo ansible
sudo su
echo 'ansible ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
exit
exit
# On host machine
# Copy SSH key to node
ssh-copy-id ansible@ubuntu-virtualbox
# Export the key to be used by Ansible
op item get "k3s-node-ansible-ssh-key" --field "private key" > $HOME/.ssh/ansible_key
```
### Run ansible playbooks
```bash
ansible-playbook -i inventory.ini playbook.yml
```
### Setup kubeconfig
```bash
scp -i ~/.ssh/ansible_key ansible@ubuntu-virtualbox:/etc/rancher/k3s/k3s.yaml ~/k3s.yaml
sed -i '' 's/127.0.0.1/192.168.202.14/g' ~/k3s.yaml
chmod 600 ~/k3s.yaml
export KUBECONFIG=~/k3s.yaml
kubectl get nodes
kubectl get deployments --namespace default
kubectl get pods --namespace default
kubectl get services --namespace default
```
## 🔰 Contributing
Upon first clone, install the pre-commit hooks.
```bash
pre-commit install
```
To run pre-commit hooks locally, without a git commit.
```bash
pre-commit run -a --all-files
```
To update pre-commit hooks, this ideally should be ran before a pull request is merged.
```bash
pre-commit autoupdate
```
### 📋 TODO
- [ ] Setup and configure molecule tests