|
| 1 | +# Turing Pi 2 Kubernetes Cluster |
| 2 | + |
| 3 | +Flux driven bare metal kubernetes cluster living on the edge. |
| 4 | + |
| 5 | + |
| 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) |
0 commit comments