Skip to content

πŸš€ This repo provides Ansible playbooks and roles designed to configure and manage nodes for lightweight Kubernetes clusters using K3s. 🎯

License

Notifications You must be signed in to change notification settings

Mosher-Labs/ansible-node-setup

Repository files navigation

ansible-node-setup

GitHub branch status GitHub Issues GitHub last commit GitHub repo size Libraries.io dependency status for GitHub repo GitHub License GitHub Sponsors

βš™οΈ 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

mise install pipx
pipx install --incude-deps ansible
pipx ensurepath

Configure individual node

After basic Ubuntu Server install:

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

ansible-playbook -i inventory.ini playbook.yml

Setup kubeconfig

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.

pre-commit install

To run pre-commit hooks locally, without a git commit.

pre-commit run -a --all-files

To update pre-commit hooks, this ideally should be ran before a pull request is merged.

pre-commit autoupdate

πŸ“‹ TODO

  • Setup and configure molecule tests

About

πŸš€ This repo provides Ansible playbooks and roles designed to configure and manage nodes for lightweight Kubernetes clusters using K3s. 🎯

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •