organised and linted all posts
imported workspace into obsidian linted files organized yaml frontmatter unified yaml value formats removed yaml front matter no longer needed
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
---
|
||||
title: Building a Docker Swarm With Pi's 👾 👾 👾 👾
|
||||
date: 2021-12-12T17:23:32Z
|
||||
author: "ahmza"
|
||||
description: Pis are very capable computers, when banded together they're almost unstoppable
|
||||
tags:
|
||||
- docker
|
||||
- home
|
||||
- lab
|
||||
- raspberry
|
||||
- pi
|
||||
author: ahmza
|
||||
date: 2021-12-12
|
||||
draft: false
|
||||
weight:
|
||||
|
||||
tags: ["home lab", "docker", "raspberry pi"]
|
||||
description: "Pis are very capable computers, when banded together they're almost unstoppable"
|
||||
featureimage: feature.webp
|
||||
lastmod:
|
||||
---
|
||||
|
||||
> This post is no longer valid as the cluster runs Kubernetes. The build process
|
||||
@@ -35,7 +41,7 @@ a **bare metal server that sucks a lot of power to a low power solution.**
|
||||
|
||||

|
||||
|
||||
### **Point of this post**
|
||||
### **Point Of This post**
|
||||
|
||||
After following this post you will have setup _Docker swarm_ on a cluster of Pis
|
||||
**- stay even if you have one -** and understand how to bend it
|
||||
@@ -55,7 +61,7 @@ each individual node for us. Some of these tasks are:
|
||||
- Multi-host networking
|
||||
- load balancing
|
||||
|
||||
### **Well why not** **_Kubernetes_**
|
||||
### **Well Why not** **_Kubernetes_**
|
||||
|
||||
Although _Kubernetes_ is awesome, it adds a bunch of complexity I'm not ready
|
||||
for. As well as that, from my experience creating _docker-compose_ files is a
|
||||
@@ -94,7 +100,7 @@ Put it this way, if you have 4 x 8GB nodes then you have a combined total of:
|
||||
|
||||
## **BUILD TIME !!**
|
||||
|
||||
### **Image the SD Cards**
|
||||
### **Image The SD Cards**
|
||||
|
||||
The CPU in a RaspberryPi 4 is the ARM64 architecture. When selecting Raspbian
|
||||
pick the 64-BIT option. 32bit variants will work but not make use of the hardware
|
||||
@@ -106,7 +112,7 @@ General:
|
||||
- Set the hostname
|
||||
- Set a username and password
|
||||
- Set Locale settings
|
||||
Services:
|
||||
Services:
|
||||
- Enable SSH
|
||||
- Allow public-key authentication only
|
||||
- Set your SSH Key
|
||||
@@ -114,7 +120,7 @@ General:
|
||||
> If you dont have an SSH key, read my post on SSH [Securing
|
||||
> SSH](https://blog.ahmza.com/posts/securing-ssh/)
|
||||
|
||||
### Assemble the cluster
|
||||
### Assemble the Cluster
|
||||
|
||||
Assembly depends on the case you bought, instructions should be included. Go
|
||||
ahead and piece together the cluster 🛠
|
||||
@@ -128,7 +134,7 @@ ahead and piece together the cluster 🛠
|
||||
|
||||
**Now allow the Pis to boot for a few minutes**
|
||||
|
||||
### **Sort out the Network bits**
|
||||
### **Sort Out the Network bits**
|
||||
|
||||
There are two methods you can use to set a static IP address, one is on your
|
||||
DHCP server and the other is on the device itself. Personally I prefer to set
|
||||
@@ -144,8 +150,8 @@ the DHCP leases for the Pis.
|
||||
**SSH to the Pi** then open and edit the following files
|
||||
|
||||
- /etc/dhcpcd.conf
|
||||
\_ knowing we will be using only static IPs here I delete
|
||||
everything in the file add the following
|
||||
\_ knowing we will be using only static IPs here I delete
|
||||
everything in the file add the following
|
||||
|
||||
```
|
||||
interface eth0
|
||||
@@ -296,12 +302,12 @@ The steps this playbook takes are as follows:
|
||||
3. Check for and Install updates
|
||||
4. Install any build dependencies
|
||||
5. Check if Docker is Installed
|
||||
- Download the Docker Script
|
||||
- Install Docker from script
|
||||
- Enable the Docker service
|
||||
- Add user to Docker group
|
||||
- Download the Docker Script
|
||||
- Install Docker from script
|
||||
- Enable the Docker service
|
||||
- Add user to Docker group
|
||||
6. Check if docker-compose is installed
|
||||
- Install docker-compose (This will take a while on each pi so be patient, grab a coffee)
|
||||
- Install docker-compose (This will take a while on each pi so be patient, grab a coffee)
|
||||
7. Change raspi config to wait for network before boot
|
||||
8. Reboot
|
||||
|
||||
@@ -348,7 +354,7 @@ if you can do it in the cli you can do it in _Ansible_ !!
|
||||
Now that the _Ansible_ script is done we can go ahead and actually
|
||||
configure all the Pis into the cluster.
|
||||
|
||||
### **Creating/Joining the swarm**
|
||||
### **Creating/Joining The swarm**
|
||||
|
||||
Creating and joining the cluster is easy - It is manual and tedious so this is
|
||||
something you could implement into the _Ansible_ playbook using host groups.
|
||||
@@ -357,7 +363,7 @@ something you could implement into the _Ansible_ playbook using host groups.
|
||||
|
||||
1. ssh to the main Pi, this will be the manager node.
|
||||
2. run `docker swarm init`
|
||||
- This will return a command and token. Make sure to copy them
|
||||
- This will return a command and token. Make sure to copy them
|
||||
3. exit the main Pi
|
||||
4. ssh to one of the worker nodes
|
||||
5. paste and run the copied command
|
||||
|
||||
Reference in New Issue
Block a user