Compare commits
3 Commits
3efd718ac9
...
36fbaf171a
| Author | SHA1 | Date | |
|---|---|---|---|
| 36fbaf171a | |||
| 975c059ecf | |||
| a8bc5f10e0 |
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"UnoApp": {
|
||||
"command": "dotnet",
|
||||
"args": [
|
||||
"dnx",
|
||||
"-y",
|
||||
"uno.devserver",
|
||||
"--mcp-app"
|
||||
]
|
||||
},
|
||||
"UnoDocs": {
|
||||
"url": "https://mcp.platform.uno/v1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"UnoApp": {
|
||||
"command": "dotnet",
|
||||
"args": [
|
||||
"dnx",
|
||||
"-y",
|
||||
"uno.devserver",
|
||||
"--mcp-app"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,25 @@ every file is YAML/TXT applied with `kubectl apply -f`.
|
||||
- Node IPs have moved (`10.0.2.x` → `10.1.0.x`). Any manifest referencing the
|
||||
old registry `10.0.2.119:5000` is unreachable from current nodes; use the
|
||||
public image `pgvector/pgvector:pg18-trixie` instead (see PostgreSQL migration).
|
||||
- Hetzner Cloud Firewalls (`allow-all-internal`, `allow-all-home`, `Home-ip`)
|
||||
are applied to every node: inbound only from `10.0.0.0/8` and home
|
||||
(`192.168.8.0/24`, `192.168.5.0/24`, `78.58.8.250/32`). There are no
|
||||
outbound rules, so outbound is allow-all. **Adding one outbound rule flips
|
||||
outbound to deny-all** — if you restrict egress, add the full allowlist in
|
||||
one call. See `Cluster_admin/firewall.md`.
|
||||
- IPv6 is egress-only (no inbound IPv6 rules). The `slow` SMB CSI Storage Box
|
||||
mount uses IPv6 directly; keep it that way.
|
||||
- Public IPs are kept on workers (Option A). Do not remove Primary IPs or
|
||||
repoint worker default routes without reading `Cluster_admin/firewall.md`
|
||||
and the "Firewall / egress" section in `Environment.md`.
|
||||
- Cluster → home LAN goes through the master's WireGuard (`wg0`). Hetzner's
|
||||
private network is routed (`/32` per node) and drops non-private sources, so
|
||||
each worker gets a point-to-point GRE tunnel (`169.254.8.0/24`) to the master;
|
||||
the master masquerades the traffic to `192.168.5.3` on `wg0`.
|
||||
`HomeAccess/home_lan_router_daemonset.yaml` keeps the tunnels, routes and NAT
|
||||
in place, and hardcodes the worker private IPs — update `WORKERS` when nodes
|
||||
change. The master's `wg0` peer `AllowedIPs` must include `192.168.8.0/24`
|
||||
(host config). See `HomeAccess/README.md`.
|
||||
|
||||
## Secrets are gitignored
|
||||
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
# Hetzner Cloud Firewall — inbound/outbound model
|
||||
|
||||
Operational note for the cluster's public network posture ("Option A"):
|
||||
**public IPs stay, inbound is locked down, outbound is open**. This is not a
|
||||
manifest — it is managed in the Hetzner Cloud Console / API.
|
||||
|
||||
Last verified: **2026-11-26**.
|
||||
|
||||
## Servers
|
||||
|
||||
| Server | Private IP | Public IPv4 | Public IPv6 |
|
||||
|---|---|---|---|
|
||||
| `master-4gb-hel1-2` | `10.1.0.3` | `46.62.205.103` | `2a01:4f9:c013:68e::/64` |
|
||||
| `ubuntu-4gb-hel1-docker` (Worker-0) | `10.1.0.2` | `65.108.84.87` | `2a01:4f9:c010:e481::/64` |
|
||||
| `woker-1-8gb-hel1-1` (Woker-1) | `10.1.0.4` | `95.216.198.61` | `2a01:4f9:c013:68ec::/64` |
|
||||
|
||||
## Applied firewalls
|
||||
|
||||
All three firewalls are applied to **all three** servers.
|
||||
|
||||
| Firewall | ID | Inbound | Outbound |
|
||||
|---|---|---|---|
|
||||
| `allow-all-internal` | `10660297` | TCP/UDP/GRE/ICMP/ESP from `10.0.0.0/8` | none |
|
||||
| `allow-all-home` | `10296229` | TCP/UDP/ICMP/GRE/ESP from `192.168.8.0/24`, `192.168.5.0/24` | none |
|
||||
| `Home-ip` | `10714705` | TCP/UDP from `78.58.8.250/32` (home WAN) | none |
|
||||
|
||||
All sources above are IPv4; there are **no IPv6 inbound rules**.
|
||||
|
||||
## Effective posture
|
||||
|
||||
Hetzner Cloud Firewalls are stateful:
|
||||
|
||||
- Inbound `NEW` traffic: **dropped** unless a rule allows it.
|
||||
- `ESTABLISHED` / `RELATED`: always allowed (responses to outbound connections
|
||||
come back without an inbound rule).
|
||||
- Outbound `NEW` traffic: **allowed** as long as there are no outbound rules.
|
||||
- **Trap:** as soon as *one* outbound rule exists, outbound switches to
|
||||
deny-by-default and only matching destinations pass. Do not add a single
|
||||
outbound rule without the complete allowlist.
|
||||
|
||||
Consequences:
|
||||
|
||||
- The public IPs are **not reachable from the internet**. Verified on
|
||||
2026-11-25: from the master (a non-home source) ports 22/80/443/6443 on both
|
||||
worker public IPs were blocked.
|
||||
- Home LAN/WG (`192.168.8.0/24`, `192.168.5.0/24`, `78.58.8.250`) can reach the
|
||||
nodes; the private network (`10.0.0.0/8`) can reach them.
|
||||
- IPv6 is **egress-only**: no inbound IPv6 rules, so nodes can initiate
|
||||
connections over IPv6 (used by the `slow` SMB Storage Box mount) but nothing
|
||||
can initiate in.
|
||||
- Nodes pull images and packages **directly over Hetzner** (Docker Hub, GHCR,
|
||||
Quay, Ubuntu archive, `rg.mariushome.lt`). No home/VPN dependency.
|
||||
- `rg.mariushome.lt` resolves to the home WAN (`78.58.8.250`) and is proxied by
|
||||
the home edge into the cluster; pulls need the `registry-creds` image pull
|
||||
secret (one per namespace).
|
||||
- Mailu is **not deployed** (no pods in `mailu`). Its SMTP/IMAP ports are not
|
||||
open to the internet under this posture. See `Email/README.md` step 3.4 if it
|
||||
is ever deployed.
|
||||
|
||||
## Operating the firewalls
|
||||
|
||||
The Hetzner API token is stored in the cluster (CSI token). Do **not** commit
|
||||
it or paste it into docs/logs:
|
||||
|
||||
```bash
|
||||
TOKEN=$(kubectl -n kube-system get secret hcloud -o jsonpath='{.data.token}' | base64 -d)
|
||||
```
|
||||
|
||||
Inspect firewalls and the rules applied to each server:
|
||||
|
||||
```bash
|
||||
curl -s -H "Authorization: Bearer $TOKEN" \
|
||||
https://api.hetzner.cloud/v1/firewalls | jq .
|
||||
|
||||
curl -s -H "Authorization: Bearer $TOKEN" \
|
||||
https://api.hetzner.cloud/v1/servers \
|
||||
| jq -r '.servers[] | "\(.name) firewalls=\([.public_net.firewalls[]?.id] | join(","))"'
|
||||
```
|
||||
|
||||
Replace a firewall's rules (this **replaces all rules** on that firewall, so
|
||||
include the full inbound + outbound set):
|
||||
|
||||
```bash
|
||||
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
https://api.hetzner.cloud/v1/firewalls/10296229/actions/set_rules \
|
||||
-d @rules.json
|
||||
```
|
||||
|
||||
The Console equivalent is **Firewalls → select firewall → Rules**. Changes are
|
||||
applied within seconds.
|
||||
|
||||
## If outbound must be restricted again
|
||||
|
||||
Add the complete allowlist in one `set_rules` call. Starting point (merge these
|
||||
outbound rules with the current inbound rules, or the inbound rules are lost):
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": [
|
||||
{ "direction": "out", "protocol": "tcp", "port": "80", "destination_ips": ["0.0.0.0/0", "::/0"] },
|
||||
{ "direction": "out", "protocol": "tcp", "port": "443", "destination_ips": ["0.0.0.0/0", "::/0"] },
|
||||
{ "direction": "out", "protocol": "udp", "port": "53", "destination_ips": ["0.0.0.0/0", "::/0"] },
|
||||
{ "direction": "out", "protocol": "tcp", "port": "53", "destination_ips": ["0.0.0.0/0", "::/0"] },
|
||||
{ "direction": "out", "protocol": "udp", "port": "123", "destination_ips": ["0.0.0.0/0", "::/0"] },
|
||||
{ "direction": "out", "protocol": "tcp", "port": "445", "destination_ips": ["91.98.250.141/32", "2a01:4f8:bacc:2:200::180d/128"] },
|
||||
{ "direction": "out", "protocol": "udp", "port": "51820", "destination_ips": ["78.58.8.250/32"] },
|
||||
{ "direction": "out", "protocol": "icmp", "destination_ips": ["0.0.0.0/0", "::/0"] }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- `91.98.250.141` / `2a01:4f8:bacc:2:200::180d` are the Hetzner Storage Box
|
||||
(`//u518679.your-storagebox.de`) used by the `slow` SMB StorageClass.
|
||||
- `78.58.8.250` is the home WAN / WireGuard endpoint.
|
||||
- Hetzner's own services (DNS `185.12.64.1/2`, `api.hetzner.cloud`, metadata)
|
||||
are generally exempt from firewall filtering, but the 443/53 rules cover them.
|
||||
- Test from a node immediately after: `curl` to a registry, `apt update`, and a
|
||||
throwaway `crictl pull`.
|
||||
|
||||
## Validation checklist
|
||||
|
||||
From a node:
|
||||
|
||||
```bash
|
||||
curl -s -o /dev/null -w '%{http_code}\n' https://registry-1.docker.io/v2/ # 401
|
||||
curl -s -o /dev/null -w '%{http_code}\n' http://archive.ubuntu.com/ubuntu/ # 200
|
||||
```
|
||||
|
||||
From a non-home source (e.g. the master, **not** the home network) the worker
|
||||
public IPs must refuse:
|
||||
|
||||
```bash
|
||||
nc -vz 95.216.198.61 22 # blocked from master
|
||||
nc -vz 65.108.84.87 443 # blocked from master
|
||||
```
|
||||
|
||||
Real pull test (per node):
|
||||
|
||||
```bash
|
||||
crictl pull docker.io/library/hello-world:latest
|
||||
crictl rmi docker.io/library/hello-world:latest
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- `Environment.md` → "Firewall / egress"
|
||||
- `AGENTS.md` → "Network / IP layout"
|
||||
- `Email/README.md` → step 3.4 (Mailu public SMTP/IMAP caveat)
|
||||
+10
-4
@@ -97,10 +97,16 @@ If `pwgen` is not installed: `apt-get install -y pwgen` (or use
|
||||
IMAP / Submission / ManageSieve ports must **NOT** go through Cloudflare —
|
||||
they need a direct, DNS-only route (grey cloud) to the Hetzner-announced IP.
|
||||
Mail clients should be configured against `mail.mariushome.lt` directly.
|
||||
4. **Hetzner Cloud firewall / security group**: ensure ports 25, 465, 587,
|
||||
143, 993, 4190 are open to the internet for the node(s) running the
|
||||
`front` pod. Hetzner blocks outbound 25 by default for new accounts —
|
||||
confirm it has been lifted (already done per planning).
|
||||
4. **Hetzner Cloud firewall**: the current firewalls only allow inbound from
|
||||
the private network and home (`allow-all-internal`, `allow-all-home`,
|
||||
`Home-ip`). There are **no** public inbound rules for 25/465/587/143/993/
|
||||
4190, so Mailu is not reachable directly from the internet as-is. To expose
|
||||
it, add explicit inbound TCP rules for those ports (this reopens the public
|
||||
IPs for those ports) while keeping the private/home rules. See
|
||||
`Cluster_admin/firewall.md`. Mailu is not currently deployed (no pods in
|
||||
`mailu`), so this is preparatory. Outbound is allow-all now, but Hetzner
|
||||
may still block outbound 25 for new accounts — confirm before relying on
|
||||
direct delivery.
|
||||
|
||||
## Install / upgrade
|
||||
|
||||
|
||||
+30
-1
@@ -18,11 +18,12 @@ inspecting `kubectl get/describe/logs`.
|
||||
| Directory | Purpose |
|
||||
|-------------------|----------------------------------------------------------------------|
|
||||
| `Cilium/` | Cilium networking: `LoadBalancerIPPool`, `L2AnnouncementPolicy`, ingress example |
|
||||
| `Cluster_admin/` | Operational notes (node reboot/update sequences, `kubectl cp` example) — not manifests applied to cluster |
|
||||
| `Cluster_admin/` | Operational notes (node reboot/update sequences, firewall/egress, `kubectl cp` example) — not manifests applied to cluster |
|
||||
| `Docker/PostgreSQL/` | Custom PostgreSQL image build (Dockerfile + build script) |
|
||||
| `DockerRegistry/` | Private Docker registry Deployment + Service + PVC, and a registry UI subdirectory |
|
||||
| `Email/` | Mailu mail server (Helm) + namespace + Cilium LB pool manifests |
|
||||
| `Gitea/` | Gitea Deployment/Service/Ingress/Namespace/PVC/DB-secret |
|
||||
| `HomeAccess/` | DaemonSet that routes `192.168.8.0/24` (home LAN) through the master's WireGuard + README |
|
||||
| `Immich/` | Immich server + machine-learning + redis Deployments/Services, config + secret |
|
||||
| `Monitoring/` | kube-prometheus-stack Helm values + hand-managed Grafana manifests |
|
||||
| `PostgreSQL/` | PostgreSQL manifests (only `hetzner/` subdir currently present) |
|
||||
@@ -57,6 +58,34 @@ inspecting `kubectl get/describe/logs`.
|
||||
the public image name `rg.mariushome.lt/custom-postgres` instead.
|
||||
- LB pool ranges are RFC1918 and announced via L2 on worker nodes.
|
||||
|
||||
### Firewall / egress
|
||||
|
||||
Public IPs are kept on all nodes (Option A). Hetzner Cloud Firewalls are
|
||||
applied to every node:
|
||||
|
||||
- `allow-all-internal` — inbound from `10.0.0.0/8`
|
||||
- `allow-all-home` — inbound from `192.168.8.0/24`, `192.168.5.0/24`
|
||||
- `Home-ip` — inbound from `78.58.8.250/32` (home WAN)
|
||||
|
||||
There are **no outbound rules**, so Hetzner allows all outbound. Inbound `NEW`
|
||||
from the internet is dropped; IPv6 has no inbound rules and is egress-only.
|
||||
Nodes pull images/packages directly over Hetzner, and the `slow` SMB Storage Box
|
||||
stays on direct IPv6.
|
||||
|
||||
**Gotcha:** adding a single outbound rule flips Hetzner outbound to
|
||||
deny-by-default. Add the complete allowlist in one call, or leave outbound open.
|
||||
See `Cluster_admin/firewall.md` for the rules, API commands and validation.
|
||||
|
||||
The master's WireGuard (`wg0`, `192.168.5.0/24`) is the only path between the
|
||||
cluster and the home LAN; it is **not** an internet path. It carries both
|
||||
directions: home → cluster (kubectl, LB IPs) and cluster → home (`HomeAccess/`:
|
||||
each worker gets a point-to-point GRE tunnel to the master because Hetzner's
|
||||
private network is routed and drops non-private sources, and the master
|
||||
masquerades the traffic to `192.168.5.3`). The private-only-worker design
|
||||
remains deferred: the home router does not forward the WG subnet, so home
|
||||
devices reach workers only through the master. Mailu is not deployed and its
|
||||
SMTP/IMAP ports are not open to the internet.
|
||||
|
||||
## Storage
|
||||
|
||||
Three `StorageClass`es exist:
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
# Home access from the cluster
|
||||
|
||||
Lets pods and nodes reach the home LAN at `192.168.8.0/24` (the `pop-os`
|
||||
workstation lives there) through the master's existing WireGuard tunnel.
|
||||
|
||||
```
|
||||
pod on worker --Cilium--> worker node
|
||||
| SNAT to 169.254.8.X, GRE (outer 10.1.0.X -> 10.1.0.3)
|
||||
v
|
||||
master 10.1.0.3
|
||||
| forward + MASQUERADE out wg0 (src 192.168.5.3)
|
||||
v
|
||||
home router --> 192.168.8.28
|
||||
```
|
||||
|
||||
Two things make this less obvious than it looks:
|
||||
|
||||
1. **Hetzner's private network is routed, not L2.** Each node has a `/32`
|
||||
(`10.1.0.x/32`) with a gateway at `10.1.0.1`; you cannot ARP a peer and use
|
||||
it as a next hop.
|
||||
2. **It drops non-private sources.** A packet forwarded by the master with
|
||||
`source 192.168.8.x` never reaches the worker's NIC, so the return path has
|
||||
to be tunnelled as well.
|
||||
|
||||
Hence the point-to-point GRE tunnels (`169.254.8.0/24`) between each worker and
|
||||
the master. The inner packet keeps its real source end to end; only the outer
|
||||
header uses the private node IPs. The master then masquerades `169.254.8.0/24`
|
||||
to `192.168.5.3` on `wg0`, the address the PC already answers.
|
||||
|
||||
| Worker private IP | Tunnel pair |
|
||||
|---|---|
|
||||
| `10.1.0.2` | `169.254.8.0/31` (worker `.0`, master `.1`) |
|
||||
| `10.1.0.4` | `169.254.8.4/31` (worker `.4`, master `.5`) |
|
||||
|
||||
The worker list is hardcoded in the DaemonSet (`WORKERS`). Update it when a node
|
||||
is added, removed or renumbered.
|
||||
|
||||
## Prerequisites (host-side, not managed here)
|
||||
|
||||
1. On `master-4gb-hel1-2`, the `/etc/wireguard/wg0.conf` peer for the home
|
||||
router must list the home LAN:
|
||||
|
||||
```ini
|
||||
AllowedIPs = 192.168.5.0/24, 192.168.8.0/24
|
||||
```
|
||||
|
||||
Reload with `wg syncconf wg0 <(wg-quick strip wg0)` **and** add the route if
|
||||
`ip route get 192.168.8.28` does not say `dev wg0` (`wg syncconf` does not
|
||||
install routes):
|
||||
|
||||
```bash
|
||||
ip route replace 192.168.8.0/24 dev wg0
|
||||
ip route get 192.168.8.28 # expect: dev wg0 src 192.168.5.3
|
||||
```
|
||||
|
||||
2. The home router routes `192.168.8.0/24` into the WireGuard tunnel and
|
||||
allows WireGuard ↔ LAN forwarding.
|
||||
|
||||
3. Hetzner Cloud Firewall `allow-all-home` includes `192.168.8.0/24`.
|
||||
|
||||
## Deploy
|
||||
|
||||
```bash
|
||||
kubectl apply -f HomeAccess/home_lan_router_daemonset.yaml
|
||||
kubectl -n kube-system rollout status ds/home-lan-router
|
||||
```
|
||||
|
||||
The DaemonSet is privileged with `hostNetwork: true` because it programs the
|
||||
node's interfaces, routes and iptables. A 60 s reconcile loop re-applies
|
||||
everything, so reboots, drains, Cilium upgrades and iptables flushes heal
|
||||
themselves.
|
||||
|
||||
## Verify
|
||||
|
||||
```bash
|
||||
# master: tunnels, NAT
|
||||
kubectl -n kube-system exec ds/home-lan-router -- ip -br addr show | grep home-gw
|
||||
kubectl -n kube-system exec ds/home-lan-router -- iptables -t nat -S POSTROUTING | grep 192.168.8
|
||||
|
||||
# worker: tunnel + route
|
||||
kubectl -n kube-system exec <worker-pod> -- ip route show 192.168.8.0/24
|
||||
|
||||
# end-to-end (ICMP is the quickest; use any listening TCP port on the PC)
|
||||
kubectl -n kube-system exec <worker-pod> -- ping -c2 192.168.8.28
|
||||
kubectl -n kube-system exec <worker-pod> -- nc -vz -w2 192.168.8.28 22
|
||||
kubectl -n gitea exec deploy/gitea -- curl -s -o /dev/null -w '%{http_code}\n' -m 5 http://192.168.8.28:<port-on-the-pc>/
|
||||
```
|
||||
|
||||
`<port-on-the-pc>` needs an HTTP listener; when nothing is running on `pop-os`,
|
||||
the ICMP and `nc` checks are enough.
|
||||
|
||||
## Notes
|
||||
|
||||
- Only `192.168.8.0/24` becomes reachable from pods, not the rest of the home
|
||||
network.
|
||||
- `pop-os` gets its address over DHCP. The route is subnet-wide, so a lease
|
||||
change does not break routing; add a DHCP reservation on the UniFi gateway if
|
||||
anything references the address.
|
||||
- The worker `rp_filter` must be permissive (`0`) on the GRE interfaces and the
|
||||
master's `all.rp_filter` must be `0`; the DaemonSet sets both. This is what
|
||||
lets the forwarded, un-NAT'd reply enter the stack.
|
||||
- TCP MSS is clamped to `1356` (`1396` GRE inner MTU − 40) on the workers, so
|
||||
payloads do not black-hole on PMTUD.
|
||||
- The host and the containers both use the `nf_tables` iptables backend, so
|
||||
rules are visible and editable from either side.
|
||||
|
||||
## Rollback
|
||||
|
||||
```bash
|
||||
kubectl delete -f HomeAccess/home_lan_router_daemonset.yaml
|
||||
```
|
||||
|
||||
Host state (interfaces, routes, iptables rules) survives pod deletion; remove it
|
||||
manually or reboot the nodes:
|
||||
|
||||
```bash
|
||||
# workers
|
||||
ip tunnel del home-gw
|
||||
iptables -t nat -D CILIUM_POST_nat -d 192.168.8.0/24 -j RETURN
|
||||
iptables -t nat -D POSTROUTING -s 10.0.0.0/8 -d 192.168.8.0/24 -j SNAT --to-source 169.254.8.X
|
||||
iptables -D FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
|
||||
# master
|
||||
ip tunnel del home-gw-0 home-gw-4
|
||||
iptables -t nat -D POSTROUTING -s 169.254.8.0/24 -d 192.168.8.0/24 -o wg0 -j MASQUERADE
|
||||
iptables -t nat -D POSTROUTING -s 10.0.0.0/8 -d 192.168.8.0/24 -o wg0 -j MASQUERADE
|
||||
iptables -D FORWARD -i 'home-gw+' -o wg0 -j ACCEPT
|
||||
iptables -D FORWARD -i wg0 -o 'home-gw+' -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
```
|
||||
@@ -0,0 +1,149 @@
|
||||
# Gives the cluster a route to the home LAN (192.168.8.0/24) through the
|
||||
# master's WireGuard tunnel (wg0) and SNATs it to the master's WG address, so
|
||||
# replies come back over the path the home router already knows.
|
||||
#
|
||||
# Hetzner's private network is routed (/32 per node) and drops packets whose
|
||||
# source is not a private address, so worker traffic cannot simply be routed
|
||||
# "via 10.1.0.3". Instead each worker gets a point-to-point GRE tunnel to the
|
||||
# master: the inner packet keeps its real source, the outer packet uses the
|
||||
# private node IPs.
|
||||
#
|
||||
# Prerequisite (host-side, see README.md): the master's wg0 peer must list
|
||||
# 192.168.8.0/24 in AllowedIPs.
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: home-lan-router
|
||||
namespace: kube-system
|
||||
labels:
|
||||
app: home-lan-router
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: home-lan-router
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 10%
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: home-lan-router
|
||||
spec:
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
priorityClassName: system-node-critical
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
containers:
|
||||
- name: router
|
||||
image: nicolaka/netshoot:v0.13
|
||||
command: ["/bin/bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
set -u
|
||||
|
||||
HOME_LAN="192.168.8.0/24"
|
||||
MASTER_IP="10.1.0.3"
|
||||
WG_IF="wg0"
|
||||
TUN_NET="169.254.8.0/24"
|
||||
TUN_MTU=1396
|
||||
MSS=1356
|
||||
# Worker private IPs. Update this list when a node is added,
|
||||
# removed or renumbered. The master ignores its own address.
|
||||
WORKERS="10.1.0.2 10.1.0.4"
|
||||
|
||||
is_master() {
|
||||
# The label is empty on workers; wg0 is a fallback in case the
|
||||
# label lookup comes back empty on the master.
|
||||
[ -n "${CONTROL_PLANE:-}" ] || ip link show "$WG_IF" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# /31 pair for a worker, derived from the last octet of its IP:
|
||||
# 10.1.0.2 -> 169.254.8.0/31, 10.1.0.4 -> 169.254.8.4/31.
|
||||
tun_net() { echo $(( ($1 - 2) * 2 )); }
|
||||
|
||||
master_loop() {
|
||||
for w in $WORKERS; do
|
||||
local last dev net
|
||||
last="${w##*.}"
|
||||
net="$(tun_net "$last")"
|
||||
dev="home-gw-$net"
|
||||
if ! ip link show "$dev" >/dev/null 2>&1; then
|
||||
ip tunnel add "$dev" mode gre local "$MASTER_IP" remote "$w" ttl 255
|
||||
fi
|
||||
ip link set "$dev" mtu "$TUN_MTU" up
|
||||
ip addr replace "169.254.8.$((net + 1))/31" dev "$dev"
|
||||
ip route replace "169.254.8.$net/31" dev "$dev"
|
||||
sysctl -qw "net.ipv4.conf.$dev.rp_filter=0" || true
|
||||
done
|
||||
sysctl -qw net.ipv4.conf.all.rp_filter=0 || true
|
||||
sysctl -qw net.ipv4.ip_forward=1 || true
|
||||
|
||||
for src in "$TUN_NET" "10.0.0.0/8"; do
|
||||
iptables -t nat -C POSTROUTING -s "$src" -d "$HOME_LAN" -o "$WG_IF" -j MASQUERADE 2>/dev/null \
|
||||
|| iptables -t nat -A POSTROUTING -s "$src" -d "$HOME_LAN" -o "$WG_IF" -j MASQUERADE
|
||||
done
|
||||
iptables -C FORWARD -i 'home-gw+' -o "$WG_IF" -j ACCEPT 2>/dev/null \
|
||||
|| iptables -I FORWARD 1 -i 'home-gw+' -o "$WG_IF" -j ACCEPT
|
||||
iptables -C FORWARD -i "$WG_IF" -o 'home-gw+' -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT 2>/dev/null \
|
||||
|| iptables -I FORWARD 1 -i "$WG_IF" -o 'home-gw+' -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
}
|
||||
|
||||
worker_loop() {
|
||||
local local_ip last net dev
|
||||
local_ip="$(ip route get "$MASTER_IP" | sed -n 's/.* src \([^ ]*\).*/\1/p')"
|
||||
[ -n "$local_ip" ] || { echo "ERROR: cannot determine local IP"; return 1; }
|
||||
last="${local_ip##*.}"
|
||||
net="$(tun_net "$last")"
|
||||
dev="home-gw"
|
||||
|
||||
if ! ip link show "$dev" >/dev/null 2>&1; then
|
||||
ip tunnel add "$dev" mode gre local "$local_ip" remote "$MASTER_IP" ttl 255
|
||||
fi
|
||||
ip link set "$dev" mtu "$TUN_MTU" up
|
||||
ip addr replace "169.254.8.$net/31" dev "$dev"
|
||||
ip route replace "$HOME_LAN" via "169.254.8.$((net + 1))" dev "$dev"
|
||||
sysctl -qw "net.ipv4.conf.$dev.rp_filter=0" || true
|
||||
sysctl -qw net.ipv4.conf.all.rp_filter=0 || true
|
||||
|
||||
# Let our SNAT rule own this destination, otherwise Cilium
|
||||
# masquerades to a tunnel device that has no address.
|
||||
iptables -t nat -C CILIUM_POST_nat -d "$HOME_LAN" -j RETURN 2>/dev/null \
|
||||
|| iptables -t nat -I CILIUM_POST_nat 1 -d "$HOME_LAN" -j RETURN
|
||||
iptables -t nat -C POSTROUTING -s "10.0.0.0/8" -d "$HOME_LAN" -j SNAT --to-source "169.254.8.$net" 2>/dev/null \
|
||||
|| iptables -t nat -A POSTROUTING -s "10.0.0.0/8" -d "$HOME_LAN" -j SNAT --to-source "169.254.8.$net"
|
||||
iptables -C FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT 2>/dev/null \
|
||||
|| iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -t mangle -C FORWARD -o "$dev" -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss "$MSS" 2>/dev/null \
|
||||
|| iptables -t mangle -A FORWARD -o "$dev" -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss "$MSS"
|
||||
iptables -t mangle -C FORWARD -i "$dev" -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss "$MSS" 2>/dev/null \
|
||||
|| iptables -t mangle -A FORWARD -i "$dev" -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss "$MSS"
|
||||
}
|
||||
|
||||
echo "home-lan-router: node=${NODE_NAME:-unknown} role=$(is_master && echo master || echo worker)"
|
||||
while true; do
|
||||
if is_master; then
|
||||
master_loop
|
||||
else
|
||||
worker_loop
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
env:
|
||||
- name: NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: CONTROL_PLANE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: "metadata.labels['node-role.kubernetes.io/control-plane']"
|
||||
securityContext:
|
||||
privileged: true
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
memory: 64Mi
|
||||
@@ -1,7 +1,7 @@
|
||||
# kube-prometheus-stack Helm chart values
|
||||
# Installed via:
|
||||
# helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack \
|
||||
# --namespace monitoring --version 87.3.0 -f Monitoring/kube-prometheus-stack.values.yaml
|
||||
# --namespace monitoring --version 88.6.1 -f Monitoring/kube-prometheus-stack.values.yaml
|
||||
#
|
||||
# Notes:
|
||||
# - Bundled Grafana is disabled; the hand-managed Grafana in Monitoring/Grafana/
|
||||
@@ -31,6 +31,9 @@ prometheus:
|
||||
prometheusSpec:
|
||||
# Match the previous manual deployment's retention.
|
||||
retention: 15d
|
||||
# Hard size cap: keep total TSDB size at/below 8GiB (~80% of the 10Gi PVC).
|
||||
# Prevents a metric-cardinality spike from filling the Hetzner volume.
|
||||
retentionSize: "8GB"
|
||||
|
||||
# Hetzner CSI volume, same class as the old prometheus-data PVC.
|
||||
storageSpec:
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# /// script
|
||||
# requires-python = ">=3.11"
|
||||
# dependencies = [
|
||||
# "rich",
|
||||
# "ollama",
|
||||
# ]
|
||||
# ///
|
||||
from typing import Union
|
||||
|
||||
from rich import print
|
||||
import os
|
||||
|
||||
# client = Client(headers={'Authorization': f"Bearer {os.getenv('OLLAMA_API_KEY')}"} if api_key else None)
|
||||
# --- MODIFICATION STARTS HERE ---
|
||||
ollama_url = os.getenv("OLLAMA_API_BASE_URL")
|
||||
|
||||
if not ollama_url:
|
||||
raise EnvironmentError("OLLAMA_API_BASE_URL environment variable must be set to connect to the Ollama service.")
|
||||
|
||||
client = Client(base_url=ollama_url, headers={'Authorization': f"Bearer {os.getenv('OLLAMA_API_KEY')}"} if os.getenv('OLLAMA_API_KEY') else None)
|
||||
# --- MODIFICATION ENDS HERE ---
|
||||
from ollama import WebFetchResponse, WebSearchResponse, chat, web_fetch, web_search
|
||||
|
||||
|
||||
def format_tool_results(
|
||||
results: Union[WebSearchResponse, WebFetchResponse],
|
||||
user_search: str,
|
||||
):
|
||||
output = []
|
||||
if isinstance(results, WebSearchResponse):
|
||||
output.append(f'Search results for "{user_search}":')
|
||||
for result in results.results:
|
||||
output.append(f'{result.title}' if result.title else f'{result.content}')
|
||||
output.append(f' URL: {result.url}')
|
||||
output.append(f' Content: {result.content}')
|
||||
output.append('')
|
||||
return '\n'.join(output).rstrip()
|
||||
|
||||
elif isinstance(results, WebFetchResponse):
|
||||
output.append(f'Fetch results for "{user_search}":')
|
||||
output.extend(
|
||||
[
|
||||
f'Title: {results.title}',
|
||||
f'URL: {user_search}' if user_search else '',
|
||||
f'Content: {results.content}',
|
||||
]
|
||||
)
|
||||
if results.links:
|
||||
output.append(f'Links: {", ".join(results.links)}')
|
||||
output.append('')
|
||||
return '\n'.join(output).rstrip()
|
||||
|
||||
|
||||
# client = Client(headers={'Authorization': f"Bearer {os.getenv('OLLAMA_API_KEY')}"} if api_key else None)
|
||||
available_tools = {'web_search': web_search, 'web_fetch': web_fetch}
|
||||
|
||||
query = "what is ollama's new engine"
|
||||
print('Query: ', query)
|
||||
|
||||
messages = [{'role': 'user', 'content': query}]
|
||||
while True:
|
||||
response = chat(model='qwen3', messages=messages, tools=[web_search, web_fetch], think=True)
|
||||
if response.message.thinking:
|
||||
print('Thinking: ')
|
||||
print(response.message.thinking + '\n\n')
|
||||
if response.message.content:
|
||||
print('Content: ')
|
||||
print(response.message.content + '\n')
|
||||
|
||||
messages.append(response.message)
|
||||
|
||||
if response.message.tool_calls:
|
||||
for tool_call in response.message.tool_calls:
|
||||
function_to_call = available_tools.get(tool_call.function.name)
|
||||
if function_to_call:
|
||||
args = tool_call.function.arguments
|
||||
result: Union[WebSearchResponse, WebFetchResponse] = function_to_call(**args)
|
||||
print('Result from tool call name:', tool_call.function.name, 'with arguments:')
|
||||
print(args)
|
||||
print()
|
||||
|
||||
user_search = args.get('query', '') or args.get('url', '')
|
||||
formatted_tool_results = format_tool_results(result, user_search=user_search)
|
||||
|
||||
print(formatted_tool_results[:300])
|
||||
print()
|
||||
|
||||
# caps the result at ~2000 tokens
|
||||
messages.append({'role': 'tool', 'content': formatted_tool_results[: 2000 * 4], 'tool_name': tool_call.function.name})
|
||||
else:
|
||||
print(f'Tool {tool_call.function.name} not found')
|
||||
messages.append({'role': 'tool', 'content': f'Tool {tool_call.function.name} not found', 'tool_name': tool_call.function.name})
|
||||
else:
|
||||
# no more tool calls, we can stop the loop
|
||||
break
|
||||
@@ -0,0 +1,253 @@
|
||||
# Ollama / Open WebUI → Kubernetes migration plan
|
||||
|
||||
## Current state
|
||||
|
||||
- Ollama runs on the workstation `pop-os` as a systemd service (`/usr/local/bin/ollama serve`).
|
||||
- It listens on `0.0.0.0:11434`.
|
||||
- Local models are stored under `/usr/share/ollama/.ollama/models` (≈ 24 GB). The Kubernetes Ollama instance will **not** use these; it will use **Ollama Cloud models only**.
|
||||
- The GPU is an NVIDIA GeForce RTX 2070 (8 GB VRAM) on `pop-os` — it stays on the workstation; Kubernetes has no GPU.
|
||||
- The Kubernetes cluster currently runs on three Hetzner nodes with **no GPU** and **no NVIDIA device plugin**.
|
||||
- Open WebUI runs on `pop-os` as a Docker container (`open-webui`), image `ghcr.io/open-webui/open-webui:main`, exposing host port `3000` mapped to container port `8080`.
|
||||
- Open WebUI stores data in a Docker volume (`/var/lib/docker/volumes/open-webui/_data`, ≈ 1.4 GB) mounted at `/app/backend/data`.
|
||||
- Current Open WebUI points to Ollama at `OLLAMA_BASE_URL=/ollama` via `host.docker.internal`.
|
||||
- The Kubernetes cluster has an existing PostgreSQL instance (`postgres-hetzner` in the `database` namespace) with pgvector support.
|
||||
|
||||
## Goal
|
||||
|
||||
Move Ollama and Open WebUI into the existing Kubernetes cluster:
|
||||
- Ollama will run **CPU-only** on the Hetzner nodes and use **Ollama Cloud models only**.
|
||||
- Ollama is exposed **only inside the cluster** (Service `ollama.ollama.svc.cluster.local:11434`), no Ingress.
|
||||
- Open WebUI is exposed on `chat.mariushome.lt` via Cilium dedicated LB Ingress.
|
||||
- Open WebUI connects to the in-cluster Ollama service and uses the existing PostgreSQL for its main database and pgvector RAG store.
|
||||
- This is a **fresh start** for Open WebUI data: existing chats/settings on `pop-os` are not migrated to PostgreSQL.
|
||||
- `pop-os` Ollama will be shut down after the migration.
|
||||
|
||||
## Important limitation / warning
|
||||
|
||||
The Hetzner worker nodes have only **~7.8 GB allocatable memory** and the master only **~3.8 GB**. Because Kubernetes Ollama uses **Ollama Cloud models only**, it does not download or run large models locally, so the small CPU/memory footprint is safe. If you later want to run local models in Kubernetes, you must add a larger/GPU node.
|
||||
|
||||
## Manifests added
|
||||
|
||||
All manifests are in `Ollama/`:
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `ollama_namespace.yaml` | `ollama` namespace (shared) |
|
||||
| `ollama_pvc.yaml` | PVC for Ollama state on `slow` StorageClass |
|
||||
| `ollama_secret_example.yaml` | Example Secret for `OLLAMA_API_KEY` (do NOT commit) |
|
||||
| `ollama_deployment.yaml` | CPU-only Ollama Deployment with cloud API key + PVC |
|
||||
| `ollama_service.yaml` | ClusterIP Service `ollama:11434` |
|
||||
| `openwebui_secret_example.yaml` | Example Secret with admin credentials and DB URLs (do NOT commit) |
|
||||
| `openwebui_db_setup.yaml` | One-time Job to create the `openwebui` DB/user in PostgreSQL |
|
||||
| `openwebui_deployment.yaml` | Open WebUI Deployment (PostgreSQL + pgvector) |
|
||||
| `openwebui_service.yaml` | ClusterIP Service `open-webui:8080` |
|
||||
| `openwebui_ingress.yaml` | Cilium dedicated LB ingress `chat.mariushome.lt` |
|
||||
| `openwebui_imagegen_config.yaml` | ConfigMap `openwebui-imagegen` — enables ComfyUI image generation (see below) |
|
||||
|
||||
## Image generation (ComfyUI on pop-os)
|
||||
|
||||
Image generation runs on the `pop-os` workstation (RTX 2070, 8 GB) where ComfyUI
|
||||
listens on `http://192.168.8.28:8188`. The cluster reaches it over the home-gw /
|
||||
WireGuard route: every node has a route for `192.168.8.0/24` (master via `wg0`,
|
||||
workers via `home-gw` with SNAT `10.0.0.0/8 → 169.254.8.x`), so pods can connect
|
||||
directly. No tunnel or master proxy is needed.
|
||||
|
||||
- `openwebui_imagegen_config.yaml` (`openwebui-imagegen` ConfigMap) sets
|
||||
`ENABLE_IMAGE_GENERATION=true`, `IMAGE_GENERATION_ENGINE=comfyui`,
|
||||
`IMAGE_GENERATION_MODEL=qwen-image`, `IMAGE_SIZE`, `IMAGE_STEPS`, and the full
|
||||
`COMFYUI_WORKFLOW` / `COMFYUI_WORKFLOW_NODES` (Qwen-Image 2512 + Lightning
|
||||
4-step txt2img).
|
||||
- `openwebui_deployment.yaml` consumes it via `envFrom.configMapRef`.
|
||||
- **PersistentConfig caveat:** Open WebUI stores `image_generation.*` in the
|
||||
`config` table of the `openwebui` Postgres DB, and **DB values override env**.
|
||||
Setting the ConfigMap alone is not enough on an existing install — the DB rows
|
||||
must match too. Either use Admin → Settings → Images, or update the DB:
|
||||
|
||||
```bash
|
||||
POD=$(kubectl -n database get pods -l app=postgres-hetzner -o jsonpath='{.items[0].metadata.name}')
|
||||
kubectl -n database exec $POD -- sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" psql -U "${POSTGRES_USER:-admin}" -d openwebui' <<'SQL'
|
||||
UPDATE config SET value='true'::json WHERE key='image_generation.enable';
|
||||
UPDATE config SET value=to_json('comfyui'::text) WHERE key='image_generation.engine';
|
||||
UPDATE config SET value=to_json('qwen-image'::text) WHERE key='image_generation.model';
|
||||
UPDATE config SET value=to_json('http://192.168.8.28:8188'::text) WHERE key='image_generation.comfyui.base_url';
|
||||
SQL
|
||||
```
|
||||
|
||||
- Requirements on pop-os: ComfyUI bound to the LAN (`--listen ...,192.168.8.28`,
|
||||
handled by `comfy-mode`), static IP `192.168.8.28`, and the machine powered on
|
||||
(generation fails while it is offline/asleep).
|
||||
|
||||
## Storage
|
||||
|
||||
### Ollama
|
||||
|
||||
Kubernetes Ollama uses **Ollama Cloud models only**, so no model blobs are stored locally. The Deployment mounts a PVC (`slow` StorageClass) at `/root/.ollama` to persist the Ollama Cloud login session / API key state across pod restarts.
|
||||
|
||||
### Ollama Cloud authentication
|
||||
|
||||
Ollama Cloud models require authentication. Two options:
|
||||
|
||||
1. **API key (recommended for Kubernetes)**: create an API key at https://ollama.com/settings/keys, then create the `ollama-cloud` Secret from `ollama_secret_example.yaml`. The Deployment injects `OLLAMA_API_KEY` automatically.
|
||||
|
||||
2. **Interactive signin**: exec into the pod and run `ollama signin`:
|
||||
|
||||
```bash
|
||||
kubectl -n ollama exec -it deploy/ollama -- ollama signin
|
||||
```
|
||||
|
||||
Because `/root/.ollama` is now persisted on a PVC, the session survives pod restarts.
|
||||
|
||||
### Open WebUI
|
||||
|
||||
Open WebUI uses the existing PostgreSQL (`postgres-hetzner.database.svc.cluster.local:5432`) for both the main relational database and the pgvector vector store. Uploaded files are still written to `/app/backend/data`, but since this is a fresh install, an `emptyDir` is sufficient.
|
||||
|
||||
If you later want persistence for uploads, create a small PVC using the **`slow`** StorageClass (SMB CSI — the cluster default). Do **not** use `hcloud-volumes` for Open WebUI uploads. Example:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: open-webui-uploads
|
||||
namespace: ollama
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storageClassName: slow
|
||||
```
|
||||
|
||||
## Pre-deployment database setup
|
||||
|
||||
1. The existing `postgres-secret` in the `database` namespace already contains the superuser password, so no new Secret is needed.
|
||||
2. Edit `Ollama/openwebui_db_setup.yaml` and replace the placeholder password `openwebui-password` in the `CREATE USER` statement with a strong, unique password.
|
||||
3. Create the database and user:
|
||||
|
||||
```bash
|
||||
kubectl apply -f Ollama/openwebui_db_setup.yaml
|
||||
kubectl wait job/openwebui-db-setup -n database --for=condition=complete
|
||||
kubectl delete -f Ollama/openwebui_db_setup.yaml
|
||||
```
|
||||
|
||||
If the user/database already exists from a previous run with the old password, drop them first (requires the postgres superuser):
|
||||
|
||||
```bash
|
||||
kubectl run -it --rm -n database psql-cleanup --image=rg.mariushome.lt/custom-postgres --restart=Never --env="PGUSER=admin" --env="PGPASSWORD=$(kubectl get secret -n database postgres-secret -o jsonpath='{.data.POSTGRES_PASSWORD}' | base64 -d)" -- psql -h postgres.database.svc.cluster.local -d postgres -c "DROP DATABASE IF EXISTS openwebui; DROP USER IF EXISTS openwebui;"
|
||||
```
|
||||
|
||||
## Secret creation (interactive)
|
||||
|
||||
The `openwebui-secret` must be created out-of-band because it contains passwords. Use the helper script and enter the same password you set in `openwebui_db_setup.yaml`:
|
||||
|
||||
```bash
|
||||
./Ollama/create_openwebui_secret.sh
|
||||
```
|
||||
|
||||
Or create it manually, replacing `YOUR-OPENWEBUI-DB-PASSWORD` with the password from `openwebui_db_setup.yaml`:
|
||||
|
||||
```bash
|
||||
kubectl create secret generic -n ollama openwebui-secret \
|
||||
--from-literal=WEBUI_SECRET_KEY="977a7a4e9051d31575f17ed7610c7bf7f9af9475205cc636ead271e699f1a680" \
|
||||
--from-literal=WEBUI_ADMIN_EMAIL="admin@mariushome.lt" \
|
||||
--from-literal=WEBUI_ADMIN_PASSWORD="fsbubSHADBJKASDs4s4ds5" \
|
||||
--from-literal=DATABASE_URL="postgresql://openwebui:YOUR-OPENWEBUI-DB-PASSWORD@postgres-hetzner.database.svc.cluster.local:5432/openwebui" \
|
||||
--from-literal=PGVECTOR_DB_URL="postgresql://openwebui:YOUR-OPENWEBUI-DB-PASSWORD@postgres-hetzner.database.svc.cluster.local:5432/openwebui"
|
||||
```
|
||||
|
||||
## Rollout steps
|
||||
|
||||
1. Recreate the `openwebui` database/user with the new password (see "Pre-deployment database setup" above).
|
||||
|
||||
2. Create the Open WebUI namespace:
|
||||
|
||||
```bash
|
||||
kubectl apply -f Ollama/ollama_namespace.yaml
|
||||
```
|
||||
|
||||
3. Create the `openwebui-secret` interactively (see "Secret creation" above) using the new password.
|
||||
|
||||
4. Create the Ollama PVC and (optionally) cloud Secret:
|
||||
|
||||
```bash
|
||||
# PVC for /root/.ollama state
|
||||
kubectl apply -f Ollama/ollama_pvc.yaml
|
||||
|
||||
# Optional: if using an Ollama Cloud API key, create the Secret first:
|
||||
# (Get your key from https://ollama.com/settings/keys)
|
||||
kubectl apply -f Ollama/ollama_secret_example.yaml
|
||||
```
|
||||
|
||||
5. Apply Ollama manifests:
|
||||
|
||||
```bash
|
||||
kubectl apply -f Ollama/ollama_service.yaml
|
||||
kubectl apply -f Ollama/ollama_deployment.yaml
|
||||
```
|
||||
|
||||
6. Verify Ollama is running and accessible inside the cluster:
|
||||
|
||||
```bash
|
||||
kubectl -n ollama get pods -o wide
|
||||
kubectl -n ollama logs -f deploy/ollama
|
||||
kubectl -n ollama exec -it deploy/ollama -- ollama list
|
||||
```
|
||||
|
||||
7. Apply Open WebUI manifests:
|
||||
|
||||
```bash
|
||||
kubectl apply -f Ollama/openwebui_service.yaml
|
||||
kubectl apply -f Ollama/openwebui_deployment.yaml
|
||||
kubectl apply -f Ollama/openwebui_ingress.yaml
|
||||
```
|
||||
|
||||
8. Verify:
|
||||
|
||||
```bash
|
||||
kubectl -n ollama get pods -o wide
|
||||
kubectl -n ollama logs -f deploy/open-webui
|
||||
kubectl -n ollama get ingress
|
||||
```
|
||||
|
||||
9. Update DNS for `chat.mariushome.lt` to point to the Cilium LB IP assigned to the `open-webui` Ingress.
|
||||
|
||||
10. After confirming Open WebUI works on `chat.mariushome.lt`, shut down the local `pop-os` services (keep the Docker volume as a backup):
|
||||
|
||||
```bash
|
||||
sudo systemctl stop ollama
|
||||
sudo systemctl disable ollama
|
||||
docker stop open-webui
|
||||
# Keep the volume for backup; only remove the container.
|
||||
docker rm open-webui
|
||||
```
|
||||
|
||||
## Client / consumer reconfiguration
|
||||
|
||||
- Update Open WebUI access from `http://pop-os:3000` to `http://chat.mariushome.lt`.
|
||||
- Ollama consumers inside the cluster should use `http://ollama.ollama.svc.cluster.local:11434`. No external Ollama endpoint is exposed.
|
||||
- For OpenCode, change the Ollama host to `http://ollama.ollama.svc.cluster.local:11434` if OpenCode runs inside the cluster, or use the Open WebUI endpoint externally.
|
||||
|
||||
## Important security notes
|
||||
|
||||
- Ollama is **not exposed via Ingress**; it is reachable only inside the cluster.
|
||||
- Open WebUI is exposed on `chat.mariushome.lt` inside the LAN. Do not publish it to the public Internet without an authenticating proxy.
|
||||
- Signups are disabled (`ENABLE_SIGNUP=false`). The initial admin account is bootstrapped from the Secret.
|
||||
- `openwebui_secret_example.yaml` and `openwebui_db_setup.yaml` contain sensitive values and must be created out-of-band; do not commit them.
|
||||
|
||||
## Rollback
|
||||
|
||||
```bash
|
||||
kubectl delete -f Ollama/openwebui_ingress.yaml
|
||||
kubectl delete -f Ollama/openwebui_deployment.yaml
|
||||
kubectl delete -f Ollama/openwebui_service.yaml
|
||||
kubectl delete -f Ollama/ollama_deployment.yaml
|
||||
kubectl delete -f Ollama/ollama_service.yaml
|
||||
# Restart local services on pop-os if needed:
|
||||
sudo systemctl start ollama
|
||||
docker start open-webui
|
||||
```
|
||||
|
||||
## Decisions made
|
||||
|
||||
- The `openwebui` PostgreSQL user must use a **different password than the example `openwebui-password`**. Edit `openwebui_db_setup.yaml`, replace the password in the `CREATE USER` statement, and re-run the Job to recreate the user/database before creating the `openwebui-secret`.
|
||||
- The `pop-os` Open WebUI Docker data (`/var/lib/docker/volumes/open-webui/_data`, ≈ 1.4 GB) will be **kept as a backup** after shutdown. Do not delete the Docker volume when stopping the container.
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Helper script to create the openwebui-secret without committing passwords.
|
||||
# Run interactively and enter the password when prompted.
|
||||
|
||||
NAMESPACE="ollama"
|
||||
SECRET_NAME="openwebui-secret"
|
||||
|
||||
echo "=== Create Kubernetes secret for Open WebUI ==="
|
||||
|
||||
read -rsp "Enter password for the 'openwebui' PostgreSQL user: " DB_PASSWORD
|
||||
echo
|
||||
read -rsp "Enter WEBUI_SECRET_KEY (or press Enter to auto-generate one): " SECRET_KEY
|
||||
echo
|
||||
if [[ -z "$SECRET_KEY" ]]; then
|
||||
SECRET_KEY=$(openssl rand -hex 32)
|
||||
echo "Auto-generated WEBUI_SECRET_KEY: $SECRET_KEY"
|
||||
fi
|
||||
|
||||
read -rp "Enter Open WebUI admin email [admin@mariushome.lt]: " ADMIN_EMAIL
|
||||
ADMIN_EMAIL=${ADMIN_EMAIL:-admin@mariushome.lt}
|
||||
|
||||
read -rsp "Enter Open WebUI admin password [fsbubSHADBJKASDs4s4ds5]: " ADMIN_PASSWORD
|
||||
echo
|
||||
ADMIN_PASSWORD=${ADMIN_PASSWORD:-fsbubSHADBJKASDs4s4ds5}
|
||||
|
||||
DATABASE_URL="postgresql://openwebui:${DB_PASSWORD}@postgres-hetzner.database.svc.cluster.local:5432/openwebui"
|
||||
PGVECTOR_DB_URL="postgresql://openwebui:${DB_PASSWORD}@postgres-hetzner.database.svc.cluster.local:5432/openwebui"
|
||||
|
||||
kubectl create secret generic -n "$NAMESPACE" "$SECRET_NAME" \
|
||||
--from-literal=WEBUI_SECRET_KEY="$SECRET_KEY" \
|
||||
--from-literal=WEBUI_ADMIN_EMAIL="$ADMIN_EMAIL" \
|
||||
--from-literal=WEBUI_ADMIN_PASSWORD="$ADMIN_PASSWORD" \
|
||||
--from-literal=DATABASE_URL="$DATABASE_URL" \
|
||||
--from-literal=PGVECTOR_DB_URL="$PGVECTOR_DB_URL" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
echo "Secret '$SECRET_NAME' created/updated in namespace '$NAMESPACE'."
|
||||
@@ -0,0 +1,73 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ollama
|
||||
namespace: ollama
|
||||
labels:
|
||||
app: ollama
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ollama
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ollama
|
||||
spec:
|
||||
# CPU-only Ollama running on Hetzner nodes. No GPU available.
|
||||
containers:
|
||||
- name: ollama
|
||||
image: ollama/ollama:0.32.4
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: OLLAMA_HOST
|
||||
value: "0.0.0.0:11434"
|
||||
# Optional: keep models loaded for N minutes after last use (e.g. 15m).
|
||||
# - name: OLLAMA_KEEP_ALIVE
|
||||
# value: "15m"
|
||||
# Ollama Cloud API key for cloud models. Create the ollama-cloud Secret
|
||||
# from ollama_secret_example.yaml, or sign in with `ollama signin`.
|
||||
- name: OLLAMA_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: ollama-cloud
|
||||
key: OLLAMA_API_KEY
|
||||
optional: true
|
||||
ports:
|
||||
- containerPort: 11434
|
||||
name: http
|
||||
protocol: TCP
|
||||
# OllamaCloud-only: no local model execution, so CPU/RAM needs are minimal.
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 1Gi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 11434
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 11434
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
volumeMounts:
|
||||
- name: ollama-state
|
||||
mountPath: /root/.ollama
|
||||
volumes:
|
||||
- name: ollama-state
|
||||
persistentVolumeClaim:
|
||||
claimName: ollama-state
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ollama-lb
|
||||
namespace: ollama
|
||||
labels:
|
||||
app: ollama
|
||||
io.cilium/static-ip: "true"
|
||||
annotations:
|
||||
lbipam.cilium.io/ips: 10.2.0.123
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: ollama
|
||||
ports:
|
||||
- name: http
|
||||
port: 11434
|
||||
targetPort: 11434
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: ollama
|
||||
labels:
|
||||
app: ollama
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: ollama-state
|
||||
namespace: ollama
|
||||
labels:
|
||||
app: ollama
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
storageClassName: slow
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ollama
|
||||
namespace: ollama
|
||||
labels:
|
||||
app: ollama
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: ollama
|
||||
ports:
|
||||
- name: http
|
||||
port: 11434
|
||||
targetPort: 11434
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,47 @@
|
||||
# Run this init job once to create the Open WebUI database and user on the
|
||||
# existing postgres-hetzner instance.
|
||||
#
|
||||
# This manifest references the existing postgres-secret in the database namespace.
|
||||
# If your secret has a different name or key, update the env block below.
|
||||
#
|
||||
# Then:
|
||||
# 1. kubectl apply -f Ollama/openwebui_db_setup.yaml
|
||||
# 2. kubectl wait job/openwebui-db-setup -n database --for=condition=complete
|
||||
# 3. kubectl delete -f Ollama/openwebui_db_setup.yaml
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: openwebui-db-setup
|
||||
namespace: database
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
imagePullSecrets:
|
||||
- name: registry-creds
|
||||
containers:
|
||||
- name: psql
|
||||
image: rg.mariushome.lt/custom-postgres
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: PGUSER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: postgres-secret
|
||||
key: POSTGRES_USER
|
||||
- name: PGPASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: postgres-secret
|
||||
key: POSTGRES_PASSWORD
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
psql -h postgres.database.svc.cluster.local -d postgres -e <<'SQL'
|
||||
CREATE USER openwebui WITH PASSWORD '6b44a0043b23368a18b6aa940dd30ae7299a77dcd2e555f554c51066a1e4e76f';
|
||||
CREATE DATABASE openwebui OWNER openwebui;
|
||||
\c openwebui
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
GRANT ALL PRIVILEGES ON DATABASE openwebui TO openwebui;
|
||||
SQL
|
||||
@@ -0,0 +1,107 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: open-webui
|
||||
namespace: ollama
|
||||
labels:
|
||||
app: open-webui
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: open-webui
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: open-webui
|
||||
spec:
|
||||
containers:
|
||||
- name: open-webui
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
imagePullPolicy: Always
|
||||
envFrom:
|
||||
# Image generation (ComfyUI on pop-os). See openwebui_imagegen_config.yaml.
|
||||
- configMapRef:
|
||||
name: openwebui-imagegen
|
||||
env:
|
||||
- name: OLLAMA_BASE_URL
|
||||
value: "http://ollama.ollama.svc.cluster.local:11434"
|
||||
- name: WEBUI_URL
|
||||
value: "http://chat.mariushome.lt"
|
||||
- name: PORT
|
||||
value: "8080"
|
||||
- name: ENABLE_SIGNUP
|
||||
value: "false"
|
||||
- name: ENABLE_LOGIN_FORM
|
||||
value: "true"
|
||||
- name: ENABLE_RAG
|
||||
value: "true"
|
||||
- name: RAG_EMBEDDING_ENGINE
|
||||
value: "ollama"
|
||||
- name: RAG_EMBEDDING_MODEL
|
||||
value: "nomic-embed-text"
|
||||
- name: VECTOR_DB
|
||||
value: "pgvector"
|
||||
- name: ENABLE_PERSISTENT_CONFIG
|
||||
value: "true"
|
||||
- name: WEBUI_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: openwebui-secret
|
||||
key: WEBUI_SECRET_KEY
|
||||
- name: WEBUI_ADMIN_EMAIL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: openwebui-secret
|
||||
key: WEBUI_ADMIN_EMAIL
|
||||
- name: WEBUI_ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: openwebui-secret
|
||||
key: WEBUI_ADMIN_PASSWORD
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: openwebui-secret
|
||||
key: DATABASE_URL
|
||||
- name: PGVECTOR_DB_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: openwebui-secret
|
||||
key: PGVECTOR_DB_URL
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
protocol: TCP
|
||||
resources:
|
||||
requests:
|
||||
cpu: "250m"
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 4Gi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8080
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
# Fresh PostgreSQL install: uploads go to emptyDir. Add a PVC later if needed.
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /app/backend/data
|
||||
volumes:
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,22 @@
|
||||
# Image generation config for Open WebUI (Kubernetes).
|
||||
# Points Open WebUI at ComfyUI running on pop-os (GPU), reachable from the
|
||||
# cluster via the home-gw / WireGuard route to 192.168.8.0/24.
|
||||
# The workflow below is the Qwen-Image 2512 + Lightning 4-step text-to-image
|
||||
# graph (matches ~/comfy/workflows/openwebui_qwen_t2i.json on pop-os).
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: openwebui-imagegen
|
||||
namespace: ollama
|
||||
labels:
|
||||
app: open-webui
|
||||
data:
|
||||
ENABLE_IMAGE_GENERATION: "true"
|
||||
IMAGE_GENERATION_ENGINE: "comfyui"
|
||||
IMAGE_GENERATION_MODEL: "qwen-image"
|
||||
IMAGE_SIZE: "1024x1024"
|
||||
IMAGE_STEPS: "4"
|
||||
COMFYUI_BASE_URL: "http://192.168.8.28:8188"
|
||||
COMFYUI_API_KEY: ""
|
||||
COMFYUI_WORKFLOW: '{"1":{"class_type":"UnetLoaderGGUF","inputs":{"unet_name":"qwen-image-Q4_K_M.gguf"}},"2":{"class_type":"CLIPLoader","inputs":{"clip_name":"qwen_2.5_vl_7b_fp8_scaled.safetensors","type":"qwen_image","device":"default"}},"3":{"class_type":"VAELoader","inputs":{"vae_name":"qwen_image_vae.safetensors"}},"4":{"class_type":"LoraLoaderModelOnly","inputs":{"model":["1",0],"lora_name":"Qwen-Image-2512-Lightning-4steps-V1.0-fp32.safetensors","strength_model":1.0}},"5":{"class_type":"ModelSamplingAuraFlow","inputs":{"model":["4",0],"shift":3.1}},"6":{"class_type":"CLIPTextEncode","inputs":{"clip":["2",0],"text":""}},"7":{"class_type":"CLIPTextEncode","inputs":{"clip":["2",0],"text":""}},"8":{"class_type":"EmptySD3LatentImage","inputs":{"width":1024,"height":1024,"batch_size":1}},"9":{"class_type":"KSampler","inputs":{"model":["5",0],"positive":["6",0],"negative":["7",0],"latent_image":["8",0],"seed":42,"steps":4,"cfg":1.0,"sampler_name":"euler","scheduler":"simple","denoise":1.0}},"10":{"class_type":"VAEDecode","inputs":{"samples":["9",0],"vae":["3",0]}},"11":{"class_type":"SaveImage","inputs":{"images":["10",0],"filename_prefix":"openwebui_qwen"}}}'
|
||||
COMFYUI_WORKFLOW_NODES: '[{"type":"prompt","node_ids":["6"],"key":"text"},{"type":"negative_prompt","node_ids":["7"],"key":"text"},{"type":"width","node_ids":["8"],"key":"width"},{"type":"height","node_ids":["8"],"key":"height"},{"type":"n","node_ids":["8"],"key":"batch_size"},{"type":"steps","node_ids":["9"],"key":"steps"},{"type":"seed","node_ids":["9"],"key":"seed"}]'
|
||||
@@ -0,0 +1,20 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: open-webui
|
||||
namespace: ollama
|
||||
annotations:
|
||||
ingress.cilium.io/loadbalancer-mode: "dedicated"
|
||||
spec:
|
||||
ingressClassName: cilium
|
||||
rules:
|
||||
- host: chat.mariushome.lt
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: open-webui
|
||||
port:
|
||||
number: 8080
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: open-webui
|
||||
namespace: ollama
|
||||
labels:
|
||||
app: open-webui
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: open-webui
|
||||
ports:
|
||||
- name: http
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,64 @@
|
||||
# PostgreSQL Backup Plan — Hetzner Storage Box
|
||||
|
||||
Goal: automated backups of the `postgres-hetzner` database (namespace `database`)
|
||||
to an off-cluster Hetzner Storage Box, using the plain-manifest style of this repo.
|
||||
|
||||
## Current state
|
||||
|
||||
- Postgres: single-replica Deployment `postgres-hetzner`, ns `database`,
|
||||
data on `hcloud-volumes` PVC (`postgres-hetzner-pvc`).
|
||||
- Image: `rg.mariushome.lt/custom-postgres` (postgres 18.4 + pgvector,
|
||||
**already contains rclone** — can talk SFTP directly, no new image build needed).
|
||||
- Credentials live in existing `postgres-secret` (POSTGRES_USER / POSTGRES_PASSWORD).
|
||||
- No backup automation exists today.
|
||||
|
||||
## Proposed approach
|
||||
|
||||
CronJob + `pg_dump` + `rclone` over SFTP (logical backups, no sidecar,
|
||||
no new Docker image, no extra PVC — stream dump into `rclone rcat`).
|
||||
|
||||
### 1. Storage Box (one-time, manual)
|
||||
- Create sub-account/directory, e.g. `postgres-backups/`.
|
||||
- SFTP endpoint: `uXXXXX@uXXXXX.your-storagebox.de:23`.
|
||||
|
||||
### 2. Secrets (gitignored — never committed)
|
||||
- New Secret `postgres-backup-secret` in `database` ns:
|
||||
- `SFTP_HOST`, `SFTP_USER`, `SFTP_PASS` (or `SFTP_KEY`).
|
||||
- DB credentials reused from existing `postgres-secret`.
|
||||
|
||||
### 3. New manifests — `PostgreSQL/backup/`
|
||||
- `postgres_backup_rclone_configmap.yaml` — rclone.conf with `storagebox:` SFTP remote.
|
||||
- `postgres_backup_cronjob.yaml` — CronJob:
|
||||
- schedule: (TBD, e.g. daily `0 3 * * *`)
|
||||
- image `rg.mariushome.lt/custom-postgres`
|
||||
- command: `pg_dumpall | rclone rcat storagebox:postgres-backups/dump-$(date).pgdump`
|
||||
- retention: `rclone delete --min-age Nd` (TBD) before/after upload
|
||||
- `concurrencyPolicy: Forbid`, history limits 1/1
|
||||
- `backoffLimit: 2`
|
||||
|
||||
### 4. Verification
|
||||
- Test run: `kubectl create job --from=cronjob/postgres-backup backup-test -n database`
|
||||
- Check logs; verify file on Storage Box via `rclone lsd` from a debug pod.
|
||||
- Document restore procedure (`pg_restore` / `psql`) in this file after first successful backup.
|
||||
|
||||
### 5. Later (optional)
|
||||
- PrometheusRule alert on failed/timed-out CronJob (kube-prometheus-stack already selects all).
|
||||
- Restore drill runbook.
|
||||
|
||||
## Open questions (fill in before implementation)
|
||||
|
||||
1. **Backup scope**: `pg_dumpall` (all DBs + roles/globals) vs. per-database `pg_dump` loop? →
|
||||
2. **Physical vs. logical**: logical `pg_dumpall` assumed OK (small homelab DB, simple restore). PITR/WAL archiving is out of scope — confirm? →
|
||||
3. **Schedule**: e.g. daily at 03:00 UTC? →
|
||||
4. **Retention**: keep N days? also keep weeklies/monthlies? →
|
||||
5. **Storage Box auth**: SSH key or password? →
|
||||
6. **Storage Box host/account**: hostname + username once the sub-account exists? →
|
||||
7. **Backup filename scheme**: OK with `postgres-backup-YYYYMMDD-HHMM.pgdump`? →
|
||||
8. **Alerting**: add PrometheusRule for failed CronJob now, or later? →
|
||||
|
||||
## Notes / constraints
|
||||
|
||||
- Dump size must fit in pod ephemeral storage if not streaming; streaming via
|
||||
`rclone rcat` avoids any local disk requirement.
|
||||
- Storage Box SFTP uses port 23 (Hetzner default).
|
||||
- Downtime is NOT required — `pg_dumpall` is online and consistent per DB.
|
||||
@@ -8,5 +8,5 @@ spec:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 39Gi
|
||||
storage: 50Gi
|
||||
storageClassName: hcloud-volumes
|
||||
@@ -8,7 +8,7 @@ homelab cluster.
|
||||
| Directory | Description |
|
||||
|------------------|---------------------------------------------------------------|
|
||||
| `Cilium/` | Cilium networking: `LoadBalancerIPPool`, `L2AnnouncementPolicy`, Ingress examples |
|
||||
| `Cluster_admin/` | Admin notes: node restart commands, data migration examples |
|
||||
| `Cluster_admin/` | Admin notes: node restart commands, firewall/egress, data migration examples |
|
||||
| `DockerRegistry/`| Private Docker registry deployment, service, PVC and UI |
|
||||
| `Gitea/` | Gitea deployment, service, ingress, namespace, PVC, DB secret |
|
||||
| `Immich/` | Immich server, machine-learning, redis, config, secret |
|
||||
|
||||
@@ -18,7 +18,8 @@ spec:
|
||||
- gid=1001
|
||||
- noperm
|
||||
- mfsymlinks
|
||||
- cache=strict
|
||||
- cache=loose # mount.cifs defaults to strict when omitted; loose gives best single-stream perf on the throttled storagebox. Valid values: strict|none|loose (not "weak")
|
||||
- actimeo=30 # default is 1s; raising it cuts stat roundtrips when listing directories
|
||||
- noserverino # required to prevent data corruption
|
||||
csi:
|
||||
driver: smb.csi.k8s.io
|
||||
|
||||
Reference in New Issue
Block a user