• This repository has been archived on 09/Nov/2021
  • Stars
    star
    366
  • Rank 116,169 (Top 3 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Stand up a Raspberry Pi based Kubernetes cluster with Ansible

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?

  • 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
    • Please change the pi user's password
  • Ansible 2.7.1 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.

Media Coverage

More Repositories

1

DevOps-README.md

What to Read to Learn More About DevOps
453
star
2

kubereadme.com

What to read to get up to speed with Kubernetes
HTML
65
star
3

devopsnewsletters.com

DevOps Newsletters of Note
HTML
61
star
4

ssl-tester

A small Go app designed specifically to help troubleshoot certificate chains
Makefile
50
star
5

devopsish.com

DevOps, Cloud Native, Hybrid Cloud, Open Source, industry news, culture, and the โ€˜ish between.
HTML
39
star
6

nomedium.dev

Medium ๐Ÿ‘Ž
HTML
34
star
7

chkcerts

A Go program to display certificate chains simply and quickly with an easy to remember syntax
Go
26
star
8

sptoolkit

Simple Phishing Toolkit is a super easy to install and use phishing framework built to help Information Security professionals find human vulnerabilities
PHP
22
star
9

kubenews.net

Kubernetes and Cloud Native Computing Foundation News Sources.
CSS
14
star
10

devopsreadme.com

devopsreadme.com โ€” What to Read to Learn More About DevOps
HTML
14
star
11

ansible-role-papertrail

Ansible Role for Deploying Papertrail to Systems
Shell
12
star
12

ultimate-development-environment

The three config files needed for building out my ultimate development environment
8
star
13

devopsish

Cloud Native, DevOps, GitOps, Open Source, industry news, culture, and the 'ish between.
JavaScript
7
star
14

github-action-git-submodules

It's annoying this has to exist but, this is a github action to checkout git submodules
Dockerfile
7
star
15

dockerfiles

Dockerfiles That I'm Probably Using... Somewhere. Be aware, some of these are for ARM systems.
Dockerfile
7
star
16

crashloopbackoff.dev

How to describe CrashLoopBackOff in a way people understand
HTML
6
star
17

eks.news

EKS News aims to be to go to newsletter for all things AWS EKS, adjacent AWS services, Kubernetes, and Cloud Native
HTML
6
star
18

memcached-operator

Example memcached-operator from Building Kubernetes Operators with Ansible
Dockerfile
3
star
19

motd-operator

Ansible-based Kubernetes Operator Using /etc/motd as an example
Dockerfile
3
star
20

chrisshort.net

chrisshort.net
HTML
3
star
21

purgeflare

Go Command Line Tool for Purging Cloudflare Cache
Makefile
3
star
22

ansible-role-adguard-home

This Ansible Role will install AdGuard Home (https://github.com/AdguardTeam/AdGuardHome) on target system(s).
Ruby
3
star
23

ansible-role-confluent-kafka

Ansible Role for Deploying Confluent Kafka
2
star
24

testing-certificate-chains-in-go

Golang to the rescue: Saving DevOps from TLS turmoil - GopherCon 2017 Lightning Talk
2
star
25

ansible-piaware

Get piaware running with Ansible
2
star
26

ntp-centos-arm

1
star
27

devopsish-license

The Best Unnecessary License in the Known Universe
1
star
28

k8s-bits

Things I run in Kubernetes
1
star
29

short.engineering

short.engineering Redirect
1
star
30

docker-centos6-percona-toolkit

A Dockerfile that provides a CentOS 6 container with Percona Toolkit installed
1
star
31

ansible-role-motd

Ansible Role to manage /etc/motd to simulate managing state
1
star
32

apple-san-francisco-pro-fonts

๐ŸŽ Apple's Family of Fonts
1
star
33

chrisshort.me

Code behind the me.chrisshort.net landing page
SCSS
1
star
34

ntp-centos

1
star
35

urlgrabber

A tool to pull working URLs out of any text base file
Go
1
star
36

red-hat-summit-2019

1
star
37

firebase-configs

Configs for projects built on Firebase used for CI
1
star
38

ansible-vault-helpers

Bash scripts for quick, easy use of Ansible Vault features
Shell
1
star
39

ischrisdead.com

A website for a talk
HTML
1
star
40

advisedbyshort.com

Advisory and consulting services from one of the top names in Kubernetes and cloud native, Chris Short
HTML
1
star