The purpose of this project is to provision your machines (VM or bare metal) for running k3s
Utilizing Ansible, the current coverage of playbooks will:
- Provision your servers for running k3s
- Install k3s
- ...
Before getting started make sure you have these following packages installed on your local machine
...
brew install ansible curl jq kubernetes-cli kubectl kubernetes-helm git calicoctl git-crypt pre-commit terraform
-
Update the Ansible vars and host inventory
# Copy and update the variables to your liking cp ./ansible/group_vars/all.sample.yml ./ansible/group_vars/all.yml # Copy and update the hosts to your liking cp ./ansible/hosts.sample.yml ./ansible/hosts.yml
-
Run the playbook
ansible ansible-playbook \ -i ansible/hosts.yml \ ansible/main.yml --ask-become-pass
...
-
Install Vagrant
brew cask install vagrant
-
Install Virtualbox 6.0
# There's a bug with the latest version of Vagrant so it is recommended to install this version of Virtualbox brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/7e703e0466a463fe26ab4e253e28baa9c20d5f36/Casks/virtualbox.rb
-
Change Vagrant permissions
sudo chown -R <YOUR_USERNAME>: /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6
-
Change to Vagrant directory
cd test/vagrant
-
Run Vagrant
vagrant up
-
Stop and remove Virtualbox VMs
vagrant destroy -f
A lot of this is a combination of various other playbooks that people have put together. See below for a handful of helpful source materials I used when piecing it together.
- https://github.com/itwars/k3s-ansible
- https://github.com/pixelpiloten/k3s-ansible
- https://github.com/geerlingguy/ansible-role-kubernetes
- https://github.com/onedr0p/k3s-gitops
- https://coderwall.com/p/13lh6w/dump-all-variables
- https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#best-practices-for-variables-and-vaults
- testing...