This project is a collection of Ansible playbooks to install kubernetes on a group of Raspberry Pi boards. There is support for installing either k8 or k3. Along with these playbooks there is also one for installing the kubernetes dashboard.
I'm finding more of a use case with using K3s with Raspberry Pi rather than K8 with it being smaller and easier to use. The K8s playbooks you can still find on the K8s branch
- Install ansible on your computer. Go here for instructions.
- Make sure your raspberry pi's are setup and you are able to ssh into them. (Will not be covered here)
- Update inventory file to match the info required to ssh into your raspberry pi's
- Run:
or
ansible-playbook k3s.yml
based on whether you want K3sansible-playbook k8s.yml //Deprecated
or K8s
The inventory file is pretty self explanitory. What ever host names you set in the inventory file will be set for the raspberry pi's in the installation playbooks. Under the master group place the host names of ones you want to serve as master nodes.
After running the ansible installation playbook the kubeconfig for the resulting cluster will be placed in the kubeconfig folder.
File Name | Description |
---|---|
k3s.yml | Install K3 |
k3s-cleanup.yml | Uninstall K3 |
dashboard.yml | Install Kubernetes Dashboard |
As a part of installing K3s there are a number of component that are installed.
- coredns
- servicelb
- traefik
- local-storage
- metrics-server
The K3s playbook will prompt you on what components you don't want installed. By default they are all installed. In the future I will add support to allow you to update the traefik config as a part of installing k3s.
A standard K3s installation will use Sqlite embedded database. If you wish to use an external database fill out the connection settings in database.yml
. When prompted during the ansible playbook whether to use an external database enter "yes" and the external database will be used.
When running the K8s installation playbook you are prompted whether to install Weave or Flannel to use as your network between the nodes.
Inspiration was take from onedrOp's ansible project.