chris-short / rak8s

Stand up a Raspberry Pi based Kubernetes cluster with Ansible
MIT License
365 stars 112 forks source link
ansible ansible-playbooks ansible-roles kubeadm kubectl kubernetes kubernetes-cluster kubernetes-setup raspberry-pi raspberry-pi-3

rak8s

(pronounced rackets - /ˈrækɪts/)

Stand up a Raspberry Pi based Kubernetes cluster with Ansible

rak8s is maintained by Chris Short and a community of open source folks willing to help.

Why?

ARM is going to be the datacenter and home computing platform of the future. It makes a lot of sense to start getting used to working in its unique environment.

Also, it's cheaper than a year of GKE. Plus, why not run Kubernetes in your home?

Prerequisites

Hardware

Software

Recommendations

Stand Up Your Kubernetes Cluster

Download the latest release or clone the repo:

git clone https://github.com/rak8s/rak8s.git

Modify ansible.cfg and inventory

Modify the inventory file to suit your environment. Change the names to your liking and the IPs to the addresses of your Raspberry Pis.

If your SSH user on the Raspberry Pis are not the Raspbian default pi user modify remote_user in the ansible.cfg.

Confirm Ansible is working with your Raspberry Pis:

ansible -m ping all

This may fail to ping if you have not setup SSH keys and only configured your Pi's with passwords

Deploy, Deploy, Deploy

ansible-playbook cluster.yml

Interact with Kubernetes

CLI

Test your Kubernetes cluster is up and running:

kubectl get nodes

The output should look something like this:

NAME       STATUS    ROLES     AGE       VERSION
pik8s000   Ready     master    2d        v1.9.1
pik8s001   Ready     <none>    2d        v1.9.1
pik8s002   Ready     <none>    2d        v1.9.1
pik8s003   Ready     <none>    2d        v1.9.1
pik8s005   Ready     <none>    2d        v1.9.1
pik8s004   Ready     <none>    2d        v1.9.1

Dashboard

rak8s installs the non-HTTPS version of the Kubernetes dashboard. This is not recommended for production clusters but, it simplifies the setup. Access the dashboard by running:

kubectl proxy

Then open a web browser and navigate to: http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

Need to Start Over?

Did something go wrong? Nodes fail some process or not joined to the cluster? Break Docker Versions with apt-update?

Try the process again from the beginning:

ansible-playbook cleanup.yml

Wait for everything to run and then start again with:

ansible-playbook cluster.yml

Where to Get Help

If you run into any problems please join our welcoming Discourse community. If you find a bug please open an issue and pull requests are always welcome.

Etymology

rak8s (pronounced rackets - /ˈrækɪts/)

Coined by Kendrick Coleman on 13 Jan 2018

References & Credits

These playbooks were assembled using a handful of very helpful guides:

A very special thanks to Alex Ellis and the OpenFaaS community for their assitance in answering questions and making sense of some errors.

Media Coverage