Skip to content
Stand up a Raspberry Pi based Kubernetes cluster with Ansible
Branch: master
Clone or download
jimhopkinsjr and chris-short K8S patch and other clean up items (#51)
* updated ansible configs to no longer use control paths as this failed on ubuntu 16.04 when deploying

* 50 - updated k8s version to latest release, updated docker, using flannel master currently as this is the only version that worked out of the box with k8s 1.13.1 - jh

* moved python apt dependency below apt-get update to allow for new installations to update cache prior installing, fixed reboot with logic from cleanup.yml

* removed apt-get update from kubeadm main since this is in common main and added environment var to stop apt from being angry - jh

* flannel at master now supports arm and amd64 k8s labels, as such we don't need to deal with this anymore.

* more updates for 1.14, removed gpu check since it's not longer working on my pi's and failing with a nonzero exit code.
Latest commit d1b14ec Apr 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.cache Squashed commit of the following: Jan 15, 2018
.cp Squashed commit of the following: Jan 15, 2018
.log
docs Adding PR template May 2, 2018
group_vars K8S patch and other clean up items (#51) Apr 16, 2019
roles
.gitignore Squashed commit of the following: Jan 15, 2018
CNAME Create CNAME Jan 16, 2018
LICENSE Initial commit Jan 15, 2018
README.md reduce gpu memory (#48) Jan 12, 2019
_config.yml Set theme jekyll-theme-tactile Jan 16, 2018
ansible.cfg K8S patch and other clean up items (#51) Apr 16, 2019
cleanup.yml Added cleanup playbook that removes kubernetes, all images, docker-ce… Jun 11, 2018
cluster.yml
dashboard.yml
inventory
upgrade.yml upgrade playbook ready Mar 13, 2018

README.md

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

Stand up a Raspberry Pi based Kubernetes cluster with Ansible

Why?

  • Raspberry Pis are rad
  • Ansible is awesome
  • Kubernetes is keen

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

  • Raspberry Pi 3 (3 or more)
  • Class 10 SD Cards
  • Network connection (wireless or wired) with access to the internet

Software

  • Raspbian Lite (installed on each Raspberry Pi)

  • Raspberry Pis should have static IPs

    • Requirement for Kubernetes and Ansible inventory
    • You can set these via OS configuration or DHCP reservations (your choice)
  • Ability to SSH into all Raspberry Pis and escalate privileges with sudo

    • The pi user is fine just change its password
  • Ansible 2.2 or higher

  • kubectl should be available on the system you intend to use to interact with the Kubernetes cluster.

    • If you are going to login to one of the Raspberry Pis to interact with the cluster kubectl is installed and configured by default on the master Kubernetes master.
    • If you are administering the cluster from a remote machine (your laptop, desktop, server, bastion host, etc.) kubectl will not be installed on the remote machine but it will be configured to interact with the newly built cluster once kubectl is installed.

Recommendations

  • Setup SSH key pairs so your password is not required every time Ansible runs

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.

You can’t perform that action at this time.