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! π€
mise install pipx
pipx install --incude-deps ansible
pipx ensurepathAfter 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_keyansible-playbook -i inventory.ini playbook.ymlscp -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 defaultUpon first clone, install the pre-commit hooks.
pre-commit installTo run pre-commit hooks locally, without a git commit.
pre-commit run -a --all-filesTo update pre-commit hooks, this ideally should be ran before a pull request is merged.
pre-commit autoupdate- Setup and configure molecule tests