Skip to content

Commit 470a8a3

Browse files
committed
first commit
0 parents  commit 470a8a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+9555
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Continuous Deployment
2+
3+
on:
4+
create:
5+
6+
jobs:
7+
pull-request:
8+
if: github.ref_name == 'continuous-deployment'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
name: checkout
13+
- name: Set up Git
14+
run: |
15+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
16+
git config --global user.name "github-actions[bot]"
17+
- name: Create Pull Request
18+
run: |
19+
gh auth refresh -s project
20+
gh pr create --fill-first

.github/workflows/update-flux.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Update Flux
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * 1" # At 00:00 on Monday.
7+
8+
jobs:
9+
components:
10+
runs-on: ubuntu-latest
11+
env:
12+
BRANCH: update-flux
13+
INSTALL_LOCATION: ./clusters/flux-system/gotk-components.yaml
14+
steps:
15+
- name: Check out code
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Setup Flux CLI
20+
uses: fluxcd/flux2/action@main
21+
- name: Configure Git
22+
run: |
23+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
24+
git config --global user.name "github-actions[bot]"
25+
- name: Checkout branch
26+
run: |
27+
(git checkout $BRANCH && git pull) || git checkout -b $BRANCH
28+
- name: Check for updates
29+
id: update
30+
run: |
31+
flux install \
32+
--export > $INSTALL_LOCATION
33+
echo "flux_version=$(flux -v)" >> $GITHUB_OUTPUT
34+
- name: Commit
35+
continue-on-error: true
36+
run: |
37+
git add .
38+
git commit -am "${{ steps.update.outputs.flux_version }}"
39+
git push -u origin HEAD
40+
- name: GitHub Pull Request
41+
env:
42+
GH_TOKEN: ${{ github.token }}
43+
run: |
44+
gh pr create --fill-first --label CD || gh pr status

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.DS_Store
2+
3+
# Ignore editor workspace files
4+
.vscode
5+
.sublime-*
6+
.atom
7+
.editorconfig
8+
.idea
9+
.nyc_output
10+
coverage
11+
*.lcov
12+
*.swp
13+
*.swo
14+
15+
# Ignore all logfiles and tempfiles.
16+
/log/*
17+
/tmp/*
18+
!/log/.keep
19+
!/tmp/.keep

.sourceignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md

Brewfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
tap 'fluxcd/tap'
4+
brew 'fluxcd/tap/flux'
5+
6+
tap 'k0sproject/tap'
7+
brew 'k0sproject/tap/k0sctl'
8+
9+
brew 'kubernetes-cli'
10+
11+
brew 'helm'
12+
13+
brew 'cloudflared'
14+
15+
brew 'pixie'

Brewfile.lock.json

+314
Large diffs are not rendered by default.

README.md

+202
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# Turing Pi 2 Kubernetes Cluster
2+
3+
Flux driven bare metal kubernetes cluster living on the edge.
4+
5+
![IMG_1022](https://user-images.githubusercontent.com/2963800/256379395-9535575e-c533-4981-aa85-0f44d37322ea.jpg)
6+
7+
## Getting Started
8+
9+
### Turing Pi
10+
11+
A compact AI & edge computing cluster.
12+
13+
```mermaid
14+
mindmap
15+
root(clusters/local)
16+
apps
17+
home
18+
homebridge
19+
waterstream
20+
zigbee2MQTT
21+
sample
22+
red
23+
blue
24+
whoami
25+
charts
26+
cert manager
27+
cilium
28+
cloudflare tunnel
29+
grafana
30+
nvidia device plugin
31+
postgres
32+
redpanda
33+
sealed secrets
34+
manifests
35+
GatewayClass
36+
Gateway
37+
RuntimeClass
38+
StorageClass
39+
notifications
40+
slack
41+
webhooks
42+
```
43+
44+
#### Build
45+
46+
- [Densium APU](https://densium.net/products/densium-apu?Frontpanel=Dark+Walnut&Exterior=Black) 4L
47+
- [Noctua NF-A14 ULN](https://noctua.at/en/products/fan/nf-a14-uln) 140mm
48+
- [Pico PSU](https://turingpi.com/product/pico-psu/) 160w
49+
- 3x [Turing RK1](https://turingpi.com/product/turing-rk1) 8 cores / 32 GB / 6 TOPS
50+
- 1x [Nvidia Jetson Orin NX](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/#tech-specs) 8 cores / 16 GB / 100 TOPS
51+
- 4x [Samsung 970 EVO Plus NVMe M.2 SSD](https://www.samsung.com/us/computing/memory-storage/solid-state-drives/ssd-970-evo-plus-nvme-m-2-250gb-mz-v7s250b-am/) 250GB
52+
53+
32 cores / 112 GB / 118 TOPS
54+
55+
1TB storage
56+
57+
<https://turingpi.com/>
58+
59+
### Kubernetes (via k0s)
60+
61+
An open-source system for automating deployment, scaling, and management of containerized applications.
62+
63+
<https://k0sproject.io/>
64+
65+
### Flux
66+
67+
Used to **pull** repository changes into kubernetes clusters.
68+
69+
<https://fluxcd.io/>
70+
71+
### Cilium
72+
73+
Used for providing, securing, and observing network connectivity between workloads, powered by eBPF.
74+
75+
<https://cilium.io/>
76+
77+
### Brew
78+
79+
The Missing Package Manager for macOS (or Linux).
80+
81+
<https://brew.sh>
82+
83+
This repo includes a collection of dependencies to install:
84+
85+
```sh
86+
brew bundle
87+
```
88+
89+
## Usage
90+
91+
### Bootstrap
92+
93+
When spinning up the cluster for the first time, there are 3 primary steps.
94+
95+
1. Install `k0s`
96+
97+
<https://docs.k0sproject.io/v1.28.2+k0s.0/k0sctl-install/>
98+
99+
```sh
100+
k0sctl apply --config ./clusters/overlays/local/k0s.yaml
101+
k0sctl kubeconfig --config ./clusters/overlays/local/k0s.yaml
102+
# add the output of this to ~/.kube/config
103+
```
104+
105+
2. Bootstrap `flux`
106+
107+
<https://fluxcd.io/flux/installation/bootstrap/github/>
108+
109+
```sh
110+
flux bootstrap github \
111+
--components-extra=image-reflector-controller,image-automation-controller \
112+
--owner=dudo \
113+
--repository=turing-pi \
114+
--private=false \
115+
--personal=true \
116+
--path=clusters/overlays/local
117+
```
118+
119+
3. Install `cilium`
120+
121+
<https://docs.cilium.io/en/stable/gettingstarted/k8s-install-default/>
122+
123+
- [System Requirements](https://docs.cilium.io/en/stable/operations/system_requirements/#admin-system-reqs)
124+
- [Rebuilding the Linux Kernel](https://gist.github.com/dudo/7d853fd54f2d3db6e5e44b8b59ae12d5)
125+
126+
```sh
127+
cilium install --version 1.14.2
128+
cilium status --wait
129+
```
130+
131+
### kubectl
132+
133+
<https://kubernetes.io/docs/reference/kubectl/cheatsheet/>
134+
135+
```sh
136+
kubectl get GitRepository -n flux-system
137+
kubectl get Kustomization -n flux-system
138+
kubectl get HelmRelease -n blue
139+
kubectl logs -n flux-system deploy/image-automation-controller
140+
141+
kubectl run curl --image=curlimages/curl --restart=Never --rm -it -- sh
142+
kubectl run busybox --image=busybox --restart=Never --rm -it -- sh
143+
```
144+
145+
### flux
146+
147+
<https://fluxcd.io/flux/cmd/>
148+
149+
```sh
150+
flux get all -A
151+
152+
flux suspend image update my-service
153+
flux resume image update my-service
154+
155+
flux reconcile source git flux-system
156+
flux reconcile kustomization flux-system
157+
flux reconcile kustomization charts
158+
```
159+
160+
### kubeseal
161+
162+
<https://github.com/bitnami-labs/sealed-secrets>
163+
164+
```sh
165+
encoded_string=$(echo -n "This is a string" | base64)
166+
encoded_string=$(base64 <<EOF
167+
This is a
168+
multi-line string
169+
that I want to encode.
170+
EOF
171+
)
172+
173+
kubeseal --format=yaml <<EOF
174+
apiVersion: v1
175+
kind: Secret
176+
metadata:
177+
name: mysecret
178+
namespace: whatever
179+
data:
180+
my.file: ${encoded_string}
181+
EOF
182+
```
183+
184+
### Reset
185+
186+
Tearing down the cluster is a 1 step process.
187+
188+
1. Reset the cluster
189+
190+
<https://docs.k0sproject.io/v1.28.2+k0s.0/reset/>
191+
192+
```sh
193+
k0sctl reset --config ./clusters/overlays/local/k0s.yaml
194+
```
195+
196+
## Pertinent Sections
197+
198+
- [Apps](./apps)
199+
- [Charts](./charts)
200+
- [Clusters](./clusters)
201+
- [Manifests](./manifests)
202+
- [Notifications](./notifications)

apps/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Apps
2+
3+
The reason for the season! Here lives the GitRepository resources that fetch manifests from our apps' repos (per the [documentation](https://fluxcd.io/docs/guides/repository-structure/#repo-per-app)).

apps/demo/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Demo
2+
3+
Demo app to validate data.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
namespace: flux-system
5+
resources:
6+
- source.yaml

apps/demo/base/emojivoto/source.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
apiVersion: source.toolkit.fluxcd.io/v1
3+
kind: GitRepository
4+
metadata:
5+
name: emojivoto
6+
spec:
7+
interval: 10m
8+
url: https://github.com/BuoyantIO/emojivoto
9+
ref:
10+
branch: main
11+
12+
---
13+
apiVersion: kustomize.toolkit.fluxcd.io/v1
14+
kind: Kustomization
15+
metadata:
16+
name: emojivoto
17+
spec:
18+
interval: 10m
19+
sourceRef:
20+
kind: GitRepository
21+
name: emojivoto
22+
namespace: flux-system
23+
targetNamespace: emojivoto
24+
path: ./kustomize/deployment
25+
prune: true
26+
wait: true
27+
timeout: 5m

apps/demo/base/kustomization.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
resources:
5+
- namespace.yaml
6+
- emojivoto
7+
- online-boutique

apps/demo/base/namespace.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: emojivoto
6+
7+
---
8+
apiVersion: v1
9+
kind: Namespace
10+
metadata:
11+
name: online-boutique
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
namespace: flux-system
5+
resources:
6+
- source.yaml

0 commit comments

Comments
 (0)