Compare commits
59 changed files with 181 additions and 3000 deletions
|
|
@ -1,74 +0,0 @@
|
||||||
name: backup-image
|
|
||||||
# Builds the backup tooling image used by the three nightly CronJobs
|
|
||||||
# (monitoring/grafana-backup, forgejo/cluster-backup, sirius-growth/leadgen-backup).
|
|
||||||
#
|
|
||||||
# Why this is a CI build at all (card t_9d0428d8): the jobs used to run
|
|
||||||
# `apk add rsync openssh-client` at container start, so the backup depended on
|
|
||||||
# the Alpine CDN at run time. Everything is baked here instead, from a base
|
|
||||||
# image pinned by digest, and the manifests pin the resulting image by digest.
|
|
||||||
#
|
|
||||||
# CI has no cluster credentials: this job only pushes an immutable :$sha tag to
|
|
||||||
# the in-cluster Forgejo registry and prints the digest to pin. The operator
|
|
||||||
# copies that digest into the three CronJob manifests in this same repo.
|
|
||||||
#
|
|
||||||
# amd64 only, on purpose: all three Jobs are nodeSelector'd to siriussec and
|
|
||||||
# the baked kubectl release checksum is amd64. Nothing here runs on rpi.
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
paths:
|
|
||||||
- 'images/backup/**'
|
|
||||||
- '.forgejo/workflows/backup-image.yml'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: docker-amd64
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# The job image (node:20-bullseye) has no docker CLI of its own; the
|
|
||||||
# runner mounts the dind sidecar's client and cli-plugins. Verify both
|
|
||||||
# instead of assuming, and fail loudly rather than half-pushing.
|
|
||||||
- name: Verify docker CLI + buildx
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
command -v docker
|
|
||||||
docker version
|
|
||||||
docker buildx version
|
|
||||||
|
|
||||||
- name: Build and push (amd64, no attestation manifests)
|
|
||||||
env:
|
|
||||||
REG_USER: ${{ secrets.REGISTRY_USER }}
|
|
||||||
REG_PASS: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
sha=$(git rev-parse HEAD)
|
|
||||||
image=forgejo.siriusdevops.com/sirius/backup-tools
|
|
||||||
user="${REG_USER:-sirius}"
|
|
||||||
pass="${REG_PASS:-${{ github.token }}}"
|
|
||||||
echo "$pass" | docker login forgejo.siriusdevops.com -u "$user" --password-stdin
|
|
||||||
# --provenance=false --sbom=false: the tag must resolve to the single
|
|
||||||
# amd64 image manifest, so the digest a CronJob pins is exactly the
|
|
||||||
# image the pod runs (an index digest would resolve per-arch).
|
|
||||||
# --metadata-file carries the pushed manifest digest. Do NOT read it
|
|
||||||
# back with `buildx imagetools inspect`: Forgejo's /v2/token answers
|
|
||||||
# 403 to that scope set (measured), while push and kubelet pull are
|
|
||||||
# fine.
|
|
||||||
docker buildx build --platform linux/amd64 \
|
|
||||||
--provenance=false --sbom=false \
|
|
||||||
-t "$image:$sha" \
|
|
||||||
--push --metadata-file /tmp/build-meta.json images/backup
|
|
||||||
echo "pushed $image:$sha"
|
|
||||||
digest=$(tr -d '\n' < /tmp/build-meta.json \
|
|
||||||
| sed -n 's/.*"containerimage\.digest": *"\(sha256:[a-f0-9]*\)".*/\1/p')
|
|
||||||
[ -n "$digest" ] || { echo "::error::no containerimage.digest in build metadata"; cat /tmp/build-meta.json; exit 1; }
|
|
||||||
echo "BACKUP_TOOLS_DIGEST=$digest"
|
|
||||||
{
|
|
||||||
echo "### Pin this in the three backup CronJob manifests"
|
|
||||||
echo ""
|
|
||||||
echo '```'
|
|
||||||
echo "$image@$digest"
|
|
||||||
echo '```'
|
|
||||||
} | tee -a "${GITHUB_STEP_SUMMARY:-/dev/stdout}"
|
|
||||||
|
|
@ -19,10 +19,6 @@ resources:
|
||||||
- metabase.yaml
|
- metabase.yaml
|
||||||
- backup.yaml
|
- backup.yaml
|
||||||
- httproute.yaml
|
- httproute.yaml
|
||||||
# Default-deny ingress+egress + the tenant's allow list (audit F3 / t_fed52919).
|
|
||||||
- networkpolicy.yaml
|
|
||||||
# Tenant guardrails sized from the declared 1-replica shape (same card).
|
|
||||||
- quota.yaml
|
|
||||||
# Secrets, SOPS/age-encrypted in git. Flux decrypts them (the `apps`
|
# Secrets, SOPS/age-encrypted in git. Flux decrypts them (the `apps`
|
||||||
# Kustomization carries a decryption block; key = flux-system/sops-age).
|
# Kustomization carries a decryption block; key = flux-system/sops-age).
|
||||||
# Never add a plaintext Secret next to these — see docs/secrets-sops.md.
|
# Never add a plaintext Secret next to these — see docs/secrets-sops.md.
|
||||||
|
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
# Tenant isolation for `customer1` (audit finding F3 / A5-1, card t_fed52919).
|
|
||||||
#
|
|
||||||
# Two objects, two jobs:
|
|
||||||
# 1. `default-deny` (networking.k8s.io/v1) selects every pod in the namespace
|
|
||||||
# for BOTH directions and allows nothing. It is the only object here that
|
|
||||||
# creates a deny — a Kubernetes NetworkPolicy with `podSelector: {}` and no
|
|
||||||
# rules is an unambiguous deny-all in Cilium's k8s-policy path, and unlike a
|
|
||||||
# CiliumClusterwideNetworkPolicy with `endpointSelector: {}` it cannot
|
|
||||||
# accidentally select kube-system/Flux/CoreDNS.
|
|
||||||
# 2. `customer1-allow` (CiliumNetworkPolicy) re-adds exactly the traffic the
|
|
||||||
# tenant needs. Cilium unions all policies that select an endpoint, so the
|
|
||||||
# deny above plus this allow list is the effective policy.
|
|
||||||
#
|
|
||||||
# Why a CiliumNetworkPolicy for the allows: the sources to permit are Cilium
|
|
||||||
# *entities* (`ingress` = the Gateway listener proxy, `host` = the node/kubelet),
|
|
||||||
# which a stock NetworkPolicy cannot name.
|
|
||||||
#
|
|
||||||
# What this namespace is allowed to talk to — and nothing else:
|
|
||||||
# * its own pods (odoo/metabase -> pg:5432, the pg-backup CronJob -> pg),
|
|
||||||
# * kube-dns on 53.
|
|
||||||
# It gets NO internet egress (world) and NO API-server egress: the sandbox has
|
|
||||||
# no external dependency (backup.yaml: dumps stay on the local PVC, the Job has
|
|
||||||
# `automountServiceAccountToken: false`). If odoo/metabase are ever resumed and
|
|
||||||
# need an external service, add it here explicitly — that is the point.
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: NetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: default-deny
|
|
||||||
namespace: customer1
|
|
||||||
spec:
|
|
||||||
podSelector: {}
|
|
||||||
policyTypes:
|
|
||||||
- Ingress
|
|
||||||
- Egress
|
|
||||||
---
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: customer1-allow
|
|
||||||
namespace: customer1
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
Customer-1 tenant: gateway + kubelet ingress only, egress to own namespace
|
|
||||||
and cluster DNS only.
|
|
||||||
endpointSelector: {}
|
|
||||||
ingress:
|
|
||||||
# reserved:ingress Cilium Gateway/listener proxy on siriussec (8086/8087)
|
|
||||||
# reserved:host this node's kubelet probes / host-network datapath
|
|
||||||
# reserved:remote-node node-sourced traffic when the pod is on another node
|
|
||||||
# reserved:health cilium-health probes
|
|
||||||
- fromEntities:
|
|
||||||
- ingress
|
|
||||||
- host
|
|
||||||
- remote-node
|
|
||||||
- health
|
|
||||||
# Intra-namespace pod -> pod (app -> db, sidecars, the backup CronJob).
|
|
||||||
# Cilium enforces policy at BOTH ends, so this allow must exist in ingress as
|
|
||||||
# well as egress — measured on `piedmont`: with only the egress rule a pod
|
|
||||||
# could not reach its own Service (TimeoutError).
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: customer1
|
|
||||||
egress:
|
|
||||||
# Cluster DNS (CoreDNS only).
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
# Intra-namespace only: odoo/metabase -> pg:5432 and the backup Job -> pg.
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: customer1
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
# `customer1` tenant guardrails (audit finding F3 / A5-1, card t_fed52919).
|
|
||||||
#
|
|
||||||
# The sandbox is parked (`replicas: 0`, `suspend: true`, both committed in Git —
|
|
||||||
# see the README and the F21 note in the audit), so these numbers are derived
|
|
||||||
# from the DECLARED shape, not from `kubectl top` of a running tenant. Measured
|
|
||||||
# 2026-11-27 with `kubectl -n customer1 get deploy -o json` +
|
|
||||||
# `get cronjob pg-backup -o json`:
|
|
||||||
#
|
|
||||||
# workload requests limits replicas
|
|
||||||
# metabase 250m / 1Gi 1 CPU / 2Gi 0 (-> 1 when resumed)
|
|
||||||
# odoo 200m / 512Mi – / 2Gi 0 (-> 1)
|
|
||||||
# pg 100m / 256Mi – / 1Gi 0 (-> 1)
|
|
||||||
# pg-backup 50m / 128Mi – / 512Mi suspended Job
|
|
||||||
# ------------------------------------------------------------------
|
|
||||||
# total 600m / 1.88Gi 1 CPU / 5.5Gi at 1 replica + 1 Job
|
|
||||||
#
|
|
||||||
# The quota is the declared total with room for the one thing that always
|
|
||||||
# happens on a resumed stack: a RollingUpdate keeps maxSurge=25% of one replica
|
|
||||||
# alive next to the old pod. So requests get ~2x headroom (2 CPU / 4Gi), limits
|
|
||||||
# ~2x the declared peak (4 CPU / 10Gi) — a tenant cannot use more than two
|
|
||||||
# replicas' worth of anything at once, and a runaway pod is still cut off by its
|
|
||||||
# own limit, which is the LimitRange's job.
|
|
||||||
#
|
|
||||||
# Storage: 35Gi is already bound (odoo-data 10Gi + odoo-extra-addons 5Gi +
|
|
||||||
# pg-data 10Gi + backup-data 10Gi) — measured with `kubectl -n customer1 get
|
|
||||||
# pvc`. 45Gi allows exactly one more 10Gi claim and nothing more.
|
|
||||||
#
|
|
||||||
# Do not copy these numbers to another namespace: they describe this stack.
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ResourceQuota
|
|
||||||
metadata:
|
|
||||||
name: customer1-quota
|
|
||||||
namespace: customer1
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/part-of: customer1
|
|
||||||
spec:
|
|
||||||
hard:
|
|
||||||
# Compute. Requests ~2x the declared 1-replica total (550m/1792Mi).
|
|
||||||
requests.cpu: "2"
|
|
||||||
requests.memory: 4Gi
|
|
||||||
limits.cpu: "4"
|
|
||||||
limits.memory: 10Gi
|
|
||||||
# Object counts. 3 workloads x 2 pods during a rolling update = 6, plus the
|
|
||||||
# pg-backup Job and room for one debug pod.
|
|
||||||
pods: "12"
|
|
||||||
count/jobs.batch: "8"
|
|
||||||
count/cronjobs.batch: "2"
|
|
||||||
services: "6"
|
|
||||||
# Storage: 35Gi bound -> one more 10Gi claim.
|
|
||||||
requests.storage: 45Gi
|
|
||||||
persistentvolumeclaims: "6"
|
|
||||||
---
|
|
||||||
# Container defaults so the quota above is satisfiable by every pod in the
|
|
||||||
# namespace: a ResourceQuota that constrains requests.cpu/limits.cpu rejects any
|
|
||||||
# pod without them, and the LimitRange injects them. `max` is the per-container
|
|
||||||
# ceiling — 2Gi is exactly metabase's declared limit, so the parked stack
|
|
||||||
# schedules unchanged when it is resumed; anything bigger now needs a namespace
|
|
||||||
# change on purpose.
|
|
||||||
apiVersion: v1
|
|
||||||
kind: LimitRange
|
|
||||||
metadata:
|
|
||||||
name: customer1-limits
|
|
||||||
namespace: customer1
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/part-of: customer1
|
|
||||||
spec:
|
|
||||||
limits:
|
|
||||||
- type: Container
|
|
||||||
defaultRequest:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 128Mi
|
|
||||||
default:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 512Mi
|
|
||||||
max:
|
|
||||||
cpu: "1"
|
|
||||||
memory: 2Gi
|
|
||||||
min:
|
|
||||||
cpu: 50m
|
|
||||||
memory: 64Mi
|
|
||||||
|
|
@ -87,10 +87,12 @@ data:
|
||||||
# (the node runs close to DiskPressure and `local-path` lives on it).
|
# (the node runs close to DiskPressure and `local-path` lives on it).
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# No package install here on purpose: rsync/openssh-client/bash/kubectl are
|
# alpine/k8s ships kubectl/bash but not rsync/ssh; install them per run
|
||||||
# baked into the pinned image (images/backup/Dockerfile) and this pod's
|
# (~2 s). Nothing else is needed: the DB dumps run inside the CNPG pod.
|
||||||
# egress policy admits DNS, 10.10.0.5:22 and the API only, so a runtime
|
if ! command -v rsync >/dev/null || ! command -v ssh >/dev/null; then
|
||||||
# fetch would fail rather than silently dial the Alpine CDN (t_9d0428d8).
|
echo "== installing rsync + openssh-client"
|
||||||
|
apk add --no-cache rsync openssh-client >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
BACKUP_HOST=${BACKUP_HOST:[email protected]}
|
BACKUP_HOST=${BACKUP_HOST:[email protected]}
|
||||||
BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup}
|
BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup}
|
||||||
|
|
@ -244,20 +246,16 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
serviceAccountName: cluster-backup
|
serviceAccountName: cluster-backup
|
||||||
# Pulled from the in-cluster Forgejo registry (which requires auth).
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: forgejo-pull
|
|
||||||
# The forgejo-data PVC is local-path on siriussec; the pod must run
|
# The forgejo-data PVC is local-path on siriussec; the pod must run
|
||||||
# where the volume is.
|
# where the volume is.
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: siriussec
|
kubernetes.io/hostname: siriussec
|
||||||
containers:
|
containers:
|
||||||
- name: backup
|
- name: backup
|
||||||
# python3.12-alpine + rsync + openssh-client + bash + kubectl
|
# alpine/k8s carries kubectl 1.36.4 (== cluster version) so the
|
||||||
# v1.36.4 (== cluster version, so the CNPG dumps can be taken
|
# CNPG dumps can be taken through the exec API; rsync + openssh
|
||||||
# through the exec API), all baked at build time and pinned by
|
# are added at start (the pod has normal egress).
|
||||||
# digest. Nothing is installed at run time.
|
image: alpine/k8s:1.36.4
|
||||||
image: forgejo.siriusdevops.com/sirius/backup-tools@sha256:cc8dc1645111b3a80b7c4d5168f6bce3002cae7417b3725683c057976f6e379a
|
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command: ["/bin/bash", "/scripts/backup.sh"]
|
command: ["/bin/bash", "/scripts/backup.sh"]
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -58,17 +58,17 @@ spec:
|
||||||
# Bot signup lockdown: admin-only account creation (web + API).
|
# Bot signup lockdown: admin-only account creation (web + API).
|
||||||
- name: FORGEJO__service__DISABLE_REGISTRATION
|
- name: FORGEJO__service__DISABLE_REGISTRATION
|
||||||
value: "true"
|
value: "true"
|
||||||
# Public-repo browsing is ON. Audit F11 had turned this on because
|
# Registry hardening (audit F11): Forgejo hands an anonymous
|
||||||
# Forgejo issues anonymous ("ghost user") registry tokens at
|
# ("ghost user") token to /v2/token and grants Read on every
|
||||||
# /v2/token with Read on every package, so with public browsing
|
# package, regardless of the owning repo's visibility, so all app
|
||||||
# every app image was world-pullable. That coupling is now cut at
|
# images were world-downloadable. With REQUIRE_SIGNIN_VIEW the
|
||||||
# the edge instead: a Cloudflare zone custom rule ("Block anonymous
|
# token endpoint answers UNAUTHORIZED to anonymous clients and
|
||||||
# Forgejo registry tokens") blocks /v2/token unless the request
|
# containerd pulls need a dockerconfigjson secret per namespace
|
||||||
# carries Basic auth, so anonymous pulls get 403 while containerd
|
# (`forgejo-pull`, created out of band — docs/registry-pull-auth.md).
|
||||||
# (which sends its `forgejo-pull` dockerconfigjson credentials)
|
# Side effect: the Forgejo web UI/API is login-only for anonymous
|
||||||
# still pulls. Re-check that rule before turning this back to true.
|
# visitors, including the public repos.
|
||||||
- name: FORGEJO__service__REQUIRE_SIGNIN_VIEW
|
- name: FORGEJO__service__REQUIRE_SIGNIN_VIEW
|
||||||
value: "false"
|
value: "true"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
|
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
---
|
|
||||||
# Kata Containers microVM RuntimeClass for the CI capsule (card t_8aa4af50).
|
|
||||||
#
|
|
||||||
# What this buys and what it does NOT: a pod using this class still declares
|
|
||||||
# `privileged: true` — a nested dockerd needs CAP_SYS_ADMIN + CAP_NET_ADMIN in
|
|
||||||
# the pod spec, and PSA `baseline` forbids exactly those two, so `ci-runners`
|
|
||||||
# stays at `enforce: privileged` (docs/pod-security.md). What changes is what
|
|
||||||
# privilege applies to: the container runs inside a QEMU/KVM microVM, so
|
|
||||||
# "privileged" means root in a VM with no host namespaces, no host kernel and
|
|
||||||
# only the volumes the pod mounts — an escape has to beat KVM first.
|
|
||||||
#
|
|
||||||
# The handler name `kata-qemu` must exist in containerd on every node that can
|
|
||||||
# run a pod with this class (drop-in /etc/containerd/conf.d/50-kata.toml,
|
|
||||||
# kata-static 4.4.0 under /opt/kata). Installed on rpi 2026-11-27; not yet on
|
|
||||||
# siriussec — that is why only the rpi-pinned deploy runner uses this class.
|
|
||||||
apiVersion: node.k8s.io/v1
|
|
||||||
kind: RuntimeClass
|
|
||||||
metadata:
|
|
||||||
name: kata-qemu
|
|
||||||
handler: kata-qemu
|
|
||||||
# VM overhead is charged to the pod so the scheduler accounts for it. The VM
|
|
||||||
# itself is sized from the pod's memory limits (2Gi here) plus the kata
|
|
||||||
# agent/kernel.
|
|
||||||
overhead:
|
|
||||||
podFixed:
|
|
||||||
cpu: 250m
|
|
||||||
memory: 160Mi
|
|
||||||
|
|
@ -6,12 +6,6 @@ resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- ci-runners-namespace.yaml
|
- ci-runners-namespace.yaml
|
||||||
- httproute.yaml
|
- httproute.yaml
|
||||||
# Default-deny ingress+egress + the namespace allow list (audit F3 / t_fed52919).
|
|
||||||
- networkpolicy.yaml
|
|
||||||
# Egress lockdown for the cluster-backup pod: DNS + 10.10.0.5:22 + the API
|
|
||||||
# only. The allow list above cannot be narrowed per pod, so the deny for
|
|
||||||
# `world` in this policy is what applies to the job (card t_9d0428d8).
|
|
||||||
- networkpolicy-backup.yaml
|
|
||||||
- pvc.yaml
|
- pvc.yaml
|
||||||
- cluster.yaml
|
- cluster.yaml
|
||||||
- podmonitor.yaml
|
- podmonitor.yaml
|
||||||
|
|
@ -31,9 +25,6 @@ resources:
|
||||||
# (its helper pod is hardcoded to siriussec). Must sort before the runner
|
# (its helper pod is hardcoded to siriussec). Must sort before the runner
|
||||||
# Deployments that consume the claims.
|
# Deployments that consume the claims.
|
||||||
- runner-dind-storage.yaml
|
- runner-dind-storage.yaml
|
||||||
# Cluster-scoped RuntimeClass for the Kata microVM that the rpi deploy runner
|
|
||||||
# uses (card t_8aa4af50). Its handler exists in containerd on rpi only.
|
|
||||||
- kata-runtimeclass.yaml
|
|
||||||
- runner-arm64.yaml
|
- runner-arm64.yaml
|
||||||
- runner-amd64.yaml
|
- runner-amd64.yaml
|
||||||
- runner-deploy-arm64.yaml
|
- runner-deploy-arm64.yaml
|
||||||
|
|
@ -48,7 +39,3 @@ resources:
|
||||||
- secret-forgejo-runner-amd64-token.sops.yaml
|
- secret-forgejo-runner-amd64-token.sops.yaml
|
||||||
- secret-forgejo-runner-deploy-arm64-token.sops.yaml
|
- secret-forgejo-runner-deploy-arm64-token.sops.yaml
|
||||||
- secret-cluster-backup-ssh.sops.yaml
|
- secret-cluster-backup-ssh.sops.yaml
|
||||||
# Registry pull credential: cluster-backup now runs an image from the
|
|
||||||
# in-cluster Forgejo registry instead of alpine/k8s from Docker Hub
|
|
||||||
# (card t_9d0428d8).
|
|
||||||
- secret-forgejo-pull.sops.yaml
|
|
||||||
|
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
# Egress lockdown for the nightly cluster-backup CronJob (card t_9d0428d8).
|
|
||||||
#
|
|
||||||
# Why: the job used to `apk add --no-cache rsync openssh-client` at container
|
|
||||||
# start, so each run depended on the Alpine CDN (Fastly 151.101.x.132:443) and
|
|
||||||
# tripped `egress-new-dst` whenever that anycast address rotated. rsync/ssh/
|
|
||||||
# bash/kubectl are baked into images/backup/Dockerfile now.
|
|
||||||
#
|
|
||||||
# `forgejo-allow` (networkpolicy.yaml) selects every pod in this namespace and
|
|
||||||
# allows `world`, so a pod-scoped allow list alone would NOT restrict the job —
|
|
||||||
# Cilium unions multiple policies. The `egressDeny` for `world` below is what
|
|
||||||
# actually closes it (deny always beats allow), and it is scoped to this pod by
|
|
||||||
# the endpointSelector, so Forgejo's own webhooks/mirror/avatar egress is
|
|
||||||
# untouched.
|
|
||||||
#
|
|
||||||
# Allow list, and nothing else:
|
|
||||||
# * cluster DNS;
|
|
||||||
# * [email protected]:22 — the Linode node's InternalIP, so `remote-node`, not
|
|
||||||
# `world` (the rsync target and every ssh_r call);
|
|
||||||
# * kube-apiserver on 6443/443 — `kubectl get cluster` for the CNPG primary
|
|
||||||
# and `kubectl exec ... pg_dump` for both CNPG and the plain Postgres
|
|
||||||
# Deployment. Port-scoped on purpose: the apiserver shares its host IP with
|
|
||||||
# the internal Gateway listeners on 8081/8084-8087.
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: cluster-backup-egress
|
|
||||||
namespace: forgejo
|
|
||||||
labels:
|
|
||||||
app: cluster-backup
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
cluster-backup pod: cluster DNS, SSH to the backup host (10.10.0.5:22) and
|
|
||||||
the API (6443/443) only; no internet egress at run time.
|
|
||||||
endpointSelector:
|
|
||||||
matchLabels:
|
|
||||||
app: cluster-backup
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEntities:
|
|
||||||
- remote-node
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "22"
|
|
||||||
protocol: TCP
|
|
||||||
- toEntities:
|
|
||||||
- kube-apiserver
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "6443"
|
|
||||||
protocol: TCP
|
|
||||||
- port: "443"
|
|
||||||
protocol: TCP
|
|
||||||
egressDeny:
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
# Tenant isolation for `forgejo` (audit finding F3 / A5-1, card t_fed52919).
|
|
||||||
#
|
|
||||||
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the
|
|
||||||
# deny. `forgejo-allow` (CiliumNetworkPolicy) re-adds what this namespace uses:
|
|
||||||
# ingress: the Cilium Gateway proxy (`reserved:ingress`) for
|
|
||||||
# forgejo.siriusdevops.com -> forgejo:3000; the CI runners in
|
|
||||||
# `ci-runners` on 3000 only (they register/poll over the PUBLIC URL,
|
|
||||||
# so THAT traffic arrives as `reserved:ingress` — but their image
|
|
||||||
# pushes go pod->pod to the internal ClusterIP
|
|
||||||
# `forgejo.forgejo.svc.cluster.local:3000`
|
|
||||||
# (`PUSH_REGISTRY` in each repo's `.forgejo/workflows/build.yml`,
|
|
||||||
# docker daemon in the dind sidecar of the runner pod). Pod->pod is
|
|
||||||
# not `reserved:ingress`, so `default-deny` dropped it and every
|
|
||||||
# image build failed 2026-11-27 .. 2026-12-05 with
|
|
||||||
# `Get "http://forgejo.forgejo.svc.cluster.local:3000/v2/": request
|
|
||||||
# canceled ... Client.Timeout exceeded` — the cross-namespace rule IS
|
|
||||||
# required; do not delete it as redundant. Node/health entities
|
|
||||||
# cover kubelet probes; Prometheus in `monitoring` is allowed on
|
|
||||||
# 9187 only (the
|
|
||||||
# `cnpg-pg` PodMonitor scrapes the CNPG instance manager), and the
|
|
||||||
# CNPG operator in `cnpg-system` on 8000 only — the instance
|
|
||||||
# manager's HTTPS status endpoint the operator reads to derive the
|
|
||||||
# system ID and drive failover (card t_4210edec).
|
|
||||||
# egress: cluster DNS; its own pods (forgejo -> pg-rw:5432); `world` for
|
|
||||||
# outbound HTTPS (Forgejo webhooks, avatar/mirror fetches, the
|
|
||||||
# public-URL callbacks the runner flow needs); node IPs on 22, which
|
|
||||||
# is the nightly `cluster-backup` CronJob rsyncing to
|
|
||||||
# [email protected]; and `kube-apiserver`, needed by the CNPG instance
|
|
||||||
# manager and by cluster-backup's `kubectl get cluster` /
|
|
||||||
# `kubectl exec` DB dumps.
|
|
||||||
#
|
|
||||||
# The CI runner pods themselves are NOT in this namespace (they moved to
|
|
||||||
# `ci-runners` for `enforce: privileged`); `forgejo-allow` only grants them
|
|
||||||
# forgejo:3000, which is the registry push path the builds depend on.
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: NetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: default-deny
|
|
||||||
namespace: forgejo
|
|
||||||
spec:
|
|
||||||
podSelector: {}
|
|
||||||
policyTypes:
|
|
||||||
- Ingress
|
|
||||||
- Egress
|
|
||||||
---
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: forgejo-allow
|
|
||||||
namespace: forgejo
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
forgejo: gateway + kubelet + Prometheus + ci-runners registry-push ingress;
|
|
||||||
egress to own namespace, cluster DNS, the internet, SSH on node IPs and the
|
|
||||||
API.
|
|
||||||
endpointSelector: {}
|
|
||||||
ingress:
|
|
||||||
- fromEntities:
|
|
||||||
- ingress
|
|
||||||
- host
|
|
||||||
- remote-node
|
|
||||||
- health
|
|
||||||
# Intra-namespace pod -> pod (app -> db, sidecars, the backup CronJob).
|
|
||||||
# Cilium enforces policy at BOTH ends, so this allow must exist in ingress as
|
|
||||||
# well as egress — measured on `piedmont`: with only the egress rule a pod
|
|
||||||
# could not reach its own Service (TimeoutError).
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: forgejo
|
|
||||||
# CI runners (`ci-runners`) push images to the in-cluster registry at
|
|
||||||
# forgejo.forgejo.svc.cluster.local:3000 (PUSH_REGISTRY in each repo's
|
|
||||||
# build workflow; the docker daemon lives in the dind sidecar of the same
|
|
||||||
# pod, so one namespace selector covers runner + sidecar). Registration and
|
|
||||||
# polling use the public URL and arrive as `reserved:ingress`, but the push
|
|
||||||
# is pod -> pod and default-deny drops it without this rule. Port-scoped on
|
|
||||||
# purpose: the registry API only, nothing else in the namespace.
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: ci-runners
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "3000"
|
|
||||||
protocol: TCP
|
|
||||||
# The CNPG operator (`cnpg-system`) reads the instance manager's HTTPS
|
|
||||||
# status endpoint to derive the system ID and drive switchover/promotion.
|
|
||||||
# Without it the Cluster reports `Instance Status Extraction Error` and
|
|
||||||
# Ready=False while the pods serve traffic, and automated failover is dead
|
|
||||||
# (card t_4210edec). Scoped to 8000: not 5432, not the whole namespace.
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: cnpg-system
|
|
||||||
app.kubernetes.io/name: cloudnative-pg
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "8000"
|
|
||||||
protocol: TCP
|
|
||||||
# Prometheus scrapes the CNPG `pg` instance manager on 9187.
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: monitoring
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "9187"
|
|
||||||
protocol: TCP
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: forgejo
|
|
||||||
# Outbound HTTPS: webhooks, mirrors, avatar fetching.
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
# cluster-backup rsync/ssh to [email protected] (the Linode node).
|
|
||||||
- toEntities:
|
|
||||||
- remote-node
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "22"
|
|
||||||
protocol: TCP
|
|
||||||
# CNPG instance manager and cluster-backup's kubectl calls. Port-scoped on
|
|
||||||
# purpose: the apiserver is host-networked on 10.10.0.2 and Cilium attaches
|
|
||||||
# the `kube-apiserver` identity to that whole node IP — an unscoped entity
|
|
||||||
# rule also opens 8081/8084/8085/8086/8087 (the internal Gateway listeners)
|
|
||||||
# and :10250/:9100 on the same address. Measured: 10.10.0.2:8085 was OPEN
|
|
||||||
# from this namespace until the ports were named. 443 is the service port
|
|
||||||
# kubectl dials (kubernetes.default:443 -> backend 6443).
|
|
||||||
- toEntities:
|
|
||||||
- kube-apiserver
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "6443"
|
|
||||||
protocol: TCP
|
|
||||||
- port: "443"
|
|
||||||
protocol: TCP
|
|
||||||
|
|
@ -38,13 +38,6 @@ kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
name: forgejo-actions-queries
|
name: forgejo-actions-queries
|
||||||
namespace: forgejo
|
namespace: forgejo
|
||||||
labels:
|
|
||||||
# Tells the CNPG instance manager to re-read this ConfigMap on change.
|
|
||||||
# Without it a query fix (like the actions_runners dedupe below) does not
|
|
||||||
# reach the exporter until someone runs `kubectl cnpg reload` or the pod
|
|
||||||
# restarts — i.e. the fix appears to do nothing and /metrics keeps 500ing.
|
|
||||||
# This is a live reload of the queries, not a PostgreSQL restart.
|
|
||||||
cnpg.io/reload: ""
|
|
||||||
data:
|
data:
|
||||||
queries: |
|
queries: |
|
||||||
# Queue depth: jobs handed to a runner that have not started, plus the age
|
# Queue depth: jobs handed to a runner that have not started, plus the age
|
||||||
|
|
@ -104,28 +97,11 @@ data:
|
||||||
# How long ago each runner last polled Forgejo. This is the only signal that
|
# How long ago each runner last polled Forgejo. This is the only signal that
|
||||||
# says "the runner process is alive" independently of the pod being Ready —
|
# says "the runner process is alive" independently of the pod being Ready —
|
||||||
# a runner that cannot reach the forge stays Running but goes stale here.
|
# a runner that cannot reach the forge stays Running but goes stale here.
|
||||||
#
|
|
||||||
# This query MUST return at most one row per `runner` label value. The
|
|
||||||
# exporter treats a duplicate label set as a programming error and answers
|
|
||||||
# the whole /metrics request with HTTP 500 — which also drops every
|
|
||||||
# pg_stat_*/cnpg_pg_* series, not just this one (incident t_290ff037).
|
|
||||||
#
|
|
||||||
# Two defences, both needed:
|
|
||||||
# * `r.deleted IS NULL` — Forgejo soft-deletes a runner (sets `deleted` to
|
|
||||||
# an epoch, keeps the row), so stale registrations survive in the table
|
|
||||||
# after a runner is removed. They are not real runners and stay hidden
|
|
||||||
# from the admin API, but a raw table read would see them.
|
|
||||||
# * `GROUP BY r.name` with `max(last_online)` — the label *is* the name, so
|
|
||||||
# two live rows that share a name (a re-registered runner, or one pod
|
|
||||||
# started from a copied runner.ini) would otherwise collide. Reporting
|
|
||||||
# the most recent poll per name is the semantic we want anyway.
|
|
||||||
actions_runners:
|
actions_runners:
|
||||||
query: |
|
query: |
|
||||||
SELECT r.name AS runner
|
SELECT r.name AS runner
|
||||||
, COALESCE(EXTRACT(EPOCH FROM pg_catalog.now())::bigint - NULLIF(max(r.last_online), 0), -1) AS last_online_seconds
|
, COALESCE(EXTRACT(EPOCH FROM pg_catalog.now())::bigint - NULLIF(r.last_online, 0), -1) AS last_online_seconds
|
||||||
FROM action_runner r
|
FROM action_runner r
|
||||||
WHERE r.deleted IS NULL
|
|
||||||
GROUP BY r.name
|
|
||||||
metrics:
|
metrics:
|
||||||
- runner:
|
- runner:
|
||||||
usage: "LABEL"
|
usage: "LABEL"
|
||||||
|
|
|
||||||
|
|
@ -82,20 +82,13 @@ data:
|
||||||
privileged: false
|
privileged: false
|
||||||
# Same injection as arm64.toml: the job container is node:20-bullseye,
|
# Same injection as arm64.toml: the job container is node:20-bullseye,
|
||||||
# which has no docker CLI and no buildx, and deploy-site.yml needs both.
|
# which has no docker CLI and no buildx, and deploy-site.yml needs both.
|
||||||
# Both come from the dind sidecar's own filesystem.
|
# Both come from the dind sidecar's own filesystem. binfmt/QEMU is
|
||||||
#
|
# registered kernel-globally on the Pi (the POC pod's
|
||||||
# NO --memory/--memory-swap on this runner: under Kata the guest cgroup
|
# /proc/sys/fs/binfmt_misc was empty yet an amd64 build ran as x86_64),
|
||||||
# root is `domain threaded` (only cpuset/cpu/pids are delegated), so
|
# so the `--platform linux/amd64` cross build works inside the pod.
|
||||||
# dockerd cannot apply a memory limit to a job container and every job
|
# --memory caps the job container only (sibling `docker run` containers a
|
||||||
# dies at `docker run` with
|
# workflow spawns are outside the runner's control).
|
||||||
# unable to apply cgroup configuration: cannot enter cgroupv2
|
options: -v /usr/local/bin/docker:/usr/bin/docker:ro -v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g
|
||||||
# "/sys/fs/cgroup/docker" with domain controllers -- it is in threaded mode
|
|
||||||
# (measured 2026-11-27, run 1442). The bound is now the microVM itself:
|
|
||||||
# the dind container's 2Gi limit sizes the VM, so a runaway job still
|
|
||||||
# cannot touch the Pi's memory, and an OOM kills the VM (visible pod
|
|
||||||
# restart) instead of one job container. Jobs on the runc runners keep
|
|
||||||
# their limits.
|
|
||||||
options: -v /usr/local/bin/docker:/usr/bin/docker:ro -v /usr/local/libexec/docker/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
valid_volumes:
|
valid_volumes:
|
||||||
- "**"
|
- "**"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,6 @@ spec:
|
||||||
operator: Equal
|
operator: Equal
|
||||||
value: network
|
value: network
|
||||||
effect: PreferNoSchedule
|
effect: PreferNoSchedule
|
||||||
# Kata microVM (apps/base/forgejo/kata-runtimeclass.yaml, installed on rpi
|
|
||||||
# only). The pod is still `privileged: true` — a nested dockerd needs
|
|
||||||
# SYS_ADMIN+NET_ADMIN in the spec and PSA baseline forbids those two, so
|
|
||||||
# `ci-runners` stays at enforce: privileged (docs/pod-security.md). Kata
|
|
||||||
# changes the *consequence*: that privilege is VM root, not rpi's host
|
|
||||||
# root. Rollback of this whole experiment is this one field.
|
|
||||||
runtimeClassName: kata-qemu
|
|
||||||
# Group on the data volume, matching the runner gid (see fix-data-perms).
|
# Group on the data volume, matching the runner gid (see fix-data-perms).
|
||||||
securityContext:
|
securityContext:
|
||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
|
|
@ -132,24 +125,6 @@ spec:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
set -e
|
|
||||||
# --- Data root: ext4 on a loop device, not the virtiofs mount ---
|
|
||||||
# Under Kata every Kubernetes volume is a virtiofs share, and
|
|
||||||
# overlayfs refuses virtiofs as an upperdir ("failed to mount
|
|
||||||
# overlay: invalid argument"), which leaves Docker on `vfs`
|
|
||||||
# (layer copies). A loop-backed ext4 image on the PVC restores
|
|
||||||
# overlay2: measured inside the guest 2026-11-27, Storage Driver
|
|
||||||
# overlay2, 16 GiB volume, survives pod restarts because the image
|
|
||||||
# file lives on the claim. Losing it only costs a cold image cache.
|
|
||||||
IMG=/data-docker/kata-ext4.img
|
|
||||||
[ -f "$IMG" ] || fallocate -l 16G "$IMG"
|
|
||||||
[ -b /dev/loop0 ] || mknod /dev/loop0 b 7 0
|
|
||||||
if ! losetup -a | grep -q "$IMG"; then
|
|
||||||
losetup /dev/loop0 "$IMG"
|
|
||||||
fi
|
|
||||||
blkid /dev/loop0 | grep -q 'TYPE="ext4"' || mkfs.ext4 -q -F -L katadocker /dev/loop0
|
|
||||||
mount /dev/loop0 /var/lib/docker
|
|
||||||
echo "dind data-root: $(df -hT /var/lib/docker | tail -1)"
|
|
||||||
# --insecure-registry: the Pi registry is plain HTTP on the WG
|
# --insecure-registry: the Pi registry is plain HTTP on the WG
|
||||||
# hub IP. Docker only treats 127.0.0.0/8 as insecure by default,
|
# hub IP. Docker only treats 127.0.0.0/8 as insecure by default,
|
||||||
# so without this `docker push 10.10.0.1:5000/...` from a job
|
# so without this `docker push 10.10.0.1:5000/...` from a job
|
||||||
|
|
@ -167,52 +142,20 @@ spec:
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
# --- binfmt: the deploy cross-builds linux/amd64 under qemu ---
|
|
||||||
# deploy-site.yml runs `docker buildx build --platform linux/amd64`
|
|
||||||
# and until now that worked because the Pi HOST kernel had the
|
|
||||||
# qemu binfmt handlers registered. A Kata pod has its own guest
|
|
||||||
# kernel, so nothing is registered and the build dies with
|
|
||||||
# `exec format error` / `buildkit-qemu-x86_64: not found`.
|
|
||||||
# Registering inside the guest is per-VM state: it must run on
|
|
||||||
# every pod start. The tonistiigi/binfmt image is cached in the
|
|
||||||
# data-root after the first start, and the registration uses the
|
|
||||||
# F flag (interpreter fd is held by the kernel), so the image can
|
|
||||||
# exit immediately afterwards.
|
|
||||||
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc 2>/dev/null || true
|
|
||||||
if ! grep -q . /proc/sys/fs/binfmt_misc/qemu-x86_64 2>/dev/null; then
|
|
||||||
i=0
|
|
||||||
until docker run --rm --privileged tonistiigi/binfmt --install amd64 >/dev/null 2>&1; do
|
|
||||||
i=$((i+1))
|
|
||||||
if [ "$i" -ge 3 ]; then
|
|
||||||
echo "WARNING: could not register qemu-x86_64 binfmt; amd64 cross builds will fail" >&2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
grep -q . /proc/sys/fs/binfmt_misc/qemu-x86_64 2>/dev/null &&
|
|
||||||
echo "binfmt: qemu-x86_64 registered" || echo "binfmt: NOT registered" >&2
|
|
||||||
# Job containers must not start before the daemon AND the
|
|
||||||
# cross-build emulation are ready; the runner waits on this file.
|
|
||||||
touch /var/run/dind-ready
|
|
||||||
wait "$pid"
|
wait "$pid"
|
||||||
securityContext:
|
securityContext:
|
||||||
# Still required UNDER KATA: the caps a nested dockerd needs
|
# Cannot be dropped on these nodes: see the long note in
|
||||||
# (SYS_ADMIN for mounts/overlay, NET_ADMIN for docker0/iptables)
|
# runner-amd64.yaml (procfs without CAP_SYS_ADMIN, /sys/fs/cgroup
|
||||||
# are caps the pod spec must add, and PSA `baseline` forbids both —
|
# mounted read-only by kubelet, rootless dind blocked by masked
|
||||||
# no runtime works around that (measured: sysbox, gVisor, Kata, see
|
# /proc + missing /dev/net/tun). Verified live 2026-11-27.
|
||||||
# docs/pod-security.md). What Kata changes is the blast radius: this
|
# Lives in namespace ci-runners (enforce: privileged),
|
||||||
# is root inside a QEMU/KVM microVM, with no host namespaces and no
|
# not forgejo (enforce: baseline) — see runner-amd64.yaml.
|
||||||
# host kernel, not root on rpi. On a runc runner the same flag is
|
|
||||||
# host root.
|
|
||||||
privileged: true
|
privileged: true
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: dind-run
|
- name: dind-run
|
||||||
mountPath: /var/run
|
mountPath: /var/run
|
||||||
# The claim holds the loop-backed ext4 image (kata-ext4.img) rather
|
|
||||||
# than being dockerd's data-root directly: see the startup script.
|
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data-docker
|
mountPath: /var/lib/docker
|
||||||
subPath: docker
|
subPath: docker
|
||||||
resources:
|
resources:
|
||||||
# Deliberately smaller than the shared runner's 4Gi. A deploy is two
|
# Deliberately smaller than the shared runner's 4Gi. A deploy is two
|
||||||
|
|
@ -243,13 +186,9 @@ spec:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
# Wait for the dind sidecar AND its per-VM extras (loop-backed
|
|
||||||
# data-root, qemu-x86_64 binfmt) — under Kata both are set up
|
|
||||||
# inside the guest on every pod start, so the socket alone is not
|
|
||||||
# "ready". dind touches /var/run/dind-ready last.
|
|
||||||
i=0
|
i=0
|
||||||
while [ "$i" -lt 90 ]; do
|
while [ "$i" -lt 60 ]; do
|
||||||
if [ -S /var/run/docker.sock ] && [ -e /var/run/dind-ready ]; then
|
if [ -S /var/run/docker.sock ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
|
|
@ -281,17 +220,4 @@ spec:
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: forgejo-runner-deploy-arm64-dind
|
claimName: forgejo-runner-deploy-arm64-dind
|
||||||
- name: dind-run
|
- name: dind-run
|
||||||
# tmpfs on purpose, NOT the default disk-backed emptyDir: under Kata a
|
emptyDir: {}
|
||||||
# disk emptyDir is a virtiofs share, and a unix socket created on
|
|
||||||
# virtiofs is visible to the other containers in the pod but
|
|
||||||
# unconnectable. Measured 2026-11-27: the runner crashlooped on
|
|
||||||
# `cannot ping the docker daemon ... unix:///var/run/docker.sock`
|
|
||||||
# although `ls -l` showed the socket `srw-rw---- root:1000`, while the
|
|
||||||
# dind sidecar's own `docker version` on the same path worked. A
|
|
||||||
# memory-backed emptyDir is a tmpfs inside the guest, so the socket is
|
|
||||||
# a real inode the runner and the job containers can both connect to,
|
|
||||||
# and the existing `-v /var/run/docker.sock` job option keeps working.
|
|
||||||
# 64Mi holds the socket, the `dind-ready` marker and nothing else.
|
|
||||||
emptyDir:
|
|
||||||
medium: Memory
|
|
||||||
sizeLimit: 64Mi
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
.dockerconfigjson: ENC[AES256_GCM,data:QS5gZUJ0zi3YYSaCpJWSCA/JakeknWmlQ8WVKlyxh2k4zo/Ul33lhH5iQP27Z3ec6FyEtV8TUSdhkq1wGSCF7cRu00ze4qljMuviU35x2Dl5aMc7JEWvRPnypoBYNmTRulPZh5E3GdiR9VUzok643P0igJyHlQBjO8HkLiuZ41Zd7JYordQRPTH4tXlDbiJPEPfkMEyFHY/6XdEEUNv5eIUyb004d1xZccnGaMwliVNBL5xIbJpb4Bza9/Z8NYsq70cmjHH/hFq7uotnSt3B53vPnwf6Rsq9j44i3M0xQjHQf+QYa34mFncHznwxPczLo8wcmKFmZYkNZNXxzc/NryeC4w950GUZ+cSO1UKLhS8IGIal8S05IWmeIuda1k9V,iv:AN7Fn/JmSYqiERsqneSOMeV3kMRGcawgV4Y9iJrjF7E=,tag:XwEZy+ULOGiFTW1diodMgg==,type:str]
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: forgejo-pull
|
|
||||||
namespace: forgejo
|
|
||||||
type: kubernetes.io/dockerconfigjson
|
|
||||||
sops:
|
|
||||||
age:
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBjTmlMUDZOdnc1U3RGM1Jh
|
|
||||||
TTNmU3pRV3M1Y2lkNitqMkE0WHRZdXNOSlRJCnZ2eDB3ZXpvWDR6dHJBeWJpdElI
|
|
||||||
a24xelp4dGluNXNGUzJYOWlPNzdwM0EKLS0tIGJuUk1CUEEvZlVWYlFKTnVwWVRS
|
|
||||||
M2o5LzBJSEpXaklKc0ZMZ0FDa3NlV0UKmNVnlKd/Xqbisox3hrAeK45sbLJW5yS3
|
|
||||||
Y6KfweCLwk6edQ9YflAvmk2FWVi0PIMdmloObXVSvB/ZY+jeLlK4lA==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age12zdn7x72zrgu9cdv8wdj7xfx42nz09nrwpc2g09cwx5fwdm0ry6qp5h4jp
|
|
||||||
encrypted_regex: ^(data|stringData)$
|
|
||||||
lastmodified: "2026-12-04T05:28:22Z"
|
|
||||||
mac: ENC[AES256_GCM,data:goW5PeSFtc0ga5gTDAZpYFQ8xBTXA2dgOomUK9t9GX3T7nswhu6fmfXJ2zjqyYLKJ5wnVEY4pvwx9RThEpU0khcP8iBqyrzUvIEXUsoQ5lTegRxgyuowPKWBkQcrJPx5GEgHSJr5J6XlDKbbCeOW0SxnerPhpJ03ueh3yULPgKw=,iv:Z/hm3jpUXzWeabPXuecuAIm+bemjluy/xjas8dg7bUY=,tag:3coZnG6p2v6ZT0raG7b1IQ==,type:str]
|
|
||||||
version: 3.13.3
|
|
||||||
|
|
@ -15,7 +15,7 @@ instead of a host Docker container on the Pi.
|
||||||
| `osint-camera-service` | same app image | public-camera discovery + snapshots (PVC `osint-camera-snapshots` 3 Gi, shared with the app) |
|
| `osint-camera-service` | same app image | public-camera discovery + snapshots (PVC `osint-camera-snapshots` 3 Gi, shared with the app) |
|
||||||
| `osint-titiler` | `forgejo…/sirius/titiler:0.26.0` | SAR COG tile proxy, exposed same-origin at `/titiler` |
|
| `osint-titiler` | `forgejo…/sirius/titiler:0.26.0` | SAR COG tile proxy, exposed same-origin at `/titiler` |
|
||||||
| `osint-news-scraper` | `forgejo…/sirius/osint-news-scraper:amd64-58f71f5b4520` | Scrapy news scraper loop |
|
| `osint-news-scraper` | `forgejo…/sirius/osint-news-scraper:amd64-58f71f5b4520` | Scrapy news scraper loop |
|
||||||
| `osint-news-summarizer` | `forgejo…/sirius/osint-news-summarizer:amd64-fb5285df7f38` | "analyst" — Nous Portal briefs every 15 min + 23:00 recap |
|
| `osint-news-summarizer` | `forgejo…/sirius/osint-news-summarizer:amd64-fe2b5df369d0` | "analyst" — Nous Portal briefs every 15 min + 23:00 recap |
|
||||||
|
|
||||||
Every workload is pinned to `kubernetes.io/hostname: siriussec` (Gateway/Envoy
|
Every workload is pinned to `kubernetes.io/hostname: siriussec` (Gateway/Envoy
|
||||||
co-location + local-path PVs).
|
co-location + local-path PVs).
|
||||||
|
|
@ -133,29 +133,11 @@ it can actually parse.
|
||||||
|
|
||||||
## Analyst model
|
## Analyst model
|
||||||
|
|
||||||
`SUMMARY_MODEL=deepseek/deepseek-v4.1-flash-1017` (Nous Portal, 1M context,
|
`SUMMARY_MODEL=meituan/longcat-2.5:free` (free tier on the Nous Portal,
|
||||||
verified to honour `response_format: json_object`; the previous free
|
1M context, verified to honour `response_format: json_object`). It is set in
|
||||||
`meituan/longcat-2.5:free` id was retired and 404'd every call). When picking a
|
|
||||||
replacement, confirm it is in `GET /v1/models` — a stale id fails silently
|
|
||||||
because `chat()` swallows non-200s and returns an empty string. It is set in
|
|
||||||
`configmap.yaml`; changing it in the UI (`PUT /api/settings`) only takes effect
|
`configmap.yaml`; changing it in the UI (`PUT /api/settings`) only takes effect
|
||||||
when the env var is empty, because `resolve_model()` prefers the env.
|
when the env var is empty, because `resolve_model()` prefers the env.
|
||||||
|
|
||||||
## Analyst resilience + map concurrency (PR #72)
|
|
||||||
|
|
||||||
`SUMMARY_MAP_CONCURRENCY` (16, in `configmap.yaml`) sets how many map calls are
|
|
||||||
in flight. Each call is a ~20 s wall clock, so the phase is latency-bound: the
|
|
||||||
746-batch recap measured **951 s** end-to-end at 16, where 8 is projected at
|
|
||||||
~98 min. The code default is also 16; the env var is pinned so a default change
|
|
||||||
upstream cannot silently stretch the 15-min interval past its window.
|
|
||||||
|
|
||||||
A non-retryable Nous rejection (400/404/422 — e.g. a retired model id) now
|
|
||||||
raises `NousAPIError` and aborts the run with `rc=1` instead of being swallowed
|
|
||||||
as an empty completion, so the failure shows up in the pod log on the *first*
|
|
||||||
tick rather than as nine days of "idle" ticks. The per-run summary line is
|
|
||||||
`summarize done kind=<interval|recap> summary_id=… model=… batches=… articles=…
|
|
||||||
ticker=… map=… elapsed=…s`.
|
|
||||||
|
|
||||||
## Analyst grading (PR #53 + #54)
|
## Analyst grading (PR #53 + #54)
|
||||||
|
|
||||||
The map call scores every article **0-100** against a rubric in the same request
|
The map call scores every article **0-100** against a rubric in the same request
|
||||||
|
|
|
||||||
|
|
@ -1,332 +0,0 @@
|
||||||
# Freshness exporter for the osint analyst (card t_22334588).
|
|
||||||
#
|
|
||||||
# The summarizer (deploy/osint-news-summarizer) wrote no article_summaries rows
|
|
||||||
# from 2026-11-25 to 2026-12-04 while the scraper kept the articles table fresh
|
|
||||||
# (61.5k rows, newest within minutes). Nothing paged: the container was Running
|
|
||||||
# with restarts 0 and only INFO batch lines in the log, so "analyst wedged" and
|
|
||||||
# "analyst idle" looked identical from every signal the cluster had.
|
|
||||||
#
|
|
||||||
# The app has no /metrics endpoint (POST /metrics -> 404 on osint-app), so this
|
|
||||||
# is a tiny read-only exporter that answers the only question that matters:
|
|
||||||
# *when* did each side last write a row? It reads two timestamps from
|
|
||||||
# osint_data and serves them on :9187/metrics:
|
|
||||||
#
|
|
||||||
# osint_analyst_last_success_timestamp_seconds max(article_summaries.batch_timestamp)
|
|
||||||
# osint_ingest_last_article_timestamp_seconds max(articles.timestamp)
|
|
||||||
# osint_analyst_exporter_up 1 when the last DB read succeeded
|
|
||||||
#
|
|
||||||
# PromQL rules live in monitoring/controllers/home/osint-analyst.yaml
|
|
||||||
# (OsintAnalystStale, OsintIngestAliveButNoBrief).
|
|
||||||
#
|
|
||||||
# Why the summarizer image: it is the only image in this namespace that already
|
|
||||||
# ships psycopg2 and a python3, and it is pinned by tag (no floating base). The
|
|
||||||
# script uses the stdlib HTTP server, so nothing is installed at runtime and no
|
|
||||||
# new image build is needed. It tracks the summarizer's own pin (currently
|
|
||||||
# amd64-fb5285df7f38) — bump BOTH together; two different tags for one image in
|
|
||||||
# one namespace reads as drift in an audit, and the exporter only needs the
|
|
||||||
# interpreter + psycopg2, which every summarizer build carries.
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: osint-analyst-exporter
|
|
||||||
namespace: osint
|
|
||||||
data:
|
|
||||||
exporter.py: |
|
|
||||||
#!/usr/bin/env python3
|
|
||||||
"""Read-only freshness exporter for the osint analyst.
|
|
||||||
|
|
||||||
Serves /metrics on :9187. Two timestamps, nothing else:
|
|
||||||
|
|
||||||
osint_analyst_last_success_timestamp_seconds
|
|
||||||
epoch of max(article_summaries.batch_timestamp) -- when the analyst
|
|
||||||
last wrote a brief. 0 means the table is empty (stale by definition).
|
|
||||||
osint_ingest_last_article_timestamp_seconds
|
|
||||||
epoch of max(articles.timestamp) -- when the scraper last ingested.
|
|
||||||
osint_analyst_exporter_up
|
|
||||||
1 when the last database read succeeded, 0 otherwise.
|
|
||||||
|
|
||||||
On a database error the last good values are kept and `up` drops to 0, so
|
|
||||||
the timestamps keep ageing and a broken exporter escalates through the same
|
|
||||||
OsintAnalystStale alert instead of hiding behind missing series.
|
|
||||||
"""
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import threading
|
|
||||||
import time
|
|
||||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
||||||
|
|
||||||
import psycopg2
|
|
||||||
|
|
||||||
LOG = logging.getLogger("osint-analyst-exporter")
|
|
||||||
logging.basicConfig(
|
|
||||||
level=os.getenv("LOG_LEVEL", "INFO"),
|
|
||||||
format="%(asctime)s %(levelname)s %(name)s: %(message)s",
|
|
||||||
)
|
|
||||||
|
|
||||||
PORT = int(os.getenv("EXPORTER_PORT", "9187"))
|
|
||||||
# One scrape interval (30 s) of cache: Prometheus + probes hitting the
|
|
||||||
# endpoint together must not each open a database connection.
|
|
||||||
CACHE_TTL = float(os.getenv("CACHE_TTL_SECONDS", "10"))
|
|
||||||
|
|
||||||
DB_CONFIG = {
|
|
||||||
"host": os.getenv("DB_HOST", "osint-db"),
|
|
||||||
"port": int(os.getenv("DB_PORT", "5432")),
|
|
||||||
"dbname": os.getenv("DB_NAME", "osint_data"),
|
|
||||||
"user": os.getenv("DB_USER", "osint"),
|
|
||||||
"password": os.getenv("DB_PASSWORD", ""),
|
|
||||||
"connect_timeout": 5,
|
|
||||||
}
|
|
||||||
|
|
||||||
ANALYST_SQL = (
|
|
||||||
"SELECT COALESCE(EXTRACT(EPOCH FROM max(batch_timestamp))::bigint, 0) "
|
|
||||||
"FROM article_summaries"
|
|
||||||
)
|
|
||||||
INGEST_SQL = (
|
|
||||||
"SELECT COALESCE(EXTRACT(EPOCH FROM max(timestamp))::bigint, 0) "
|
|
||||||
"FROM articles"
|
|
||||||
)
|
|
||||||
|
|
||||||
_lock = threading.Lock()
|
|
||||||
_state = {"analyst": 0, "ingest": 0, "up": 0, "last_attempt": 0.0}
|
|
||||||
|
|
||||||
|
|
||||||
def collect() -> tuple[int, int]:
|
|
||||||
conn = psycopg2.connect(**DB_CONFIG)
|
|
||||||
try:
|
|
||||||
conn.autocommit = True
|
|
||||||
with conn.cursor() as cur:
|
|
||||||
cur.execute("SET statement_timeout = 5000")
|
|
||||||
cur.execute(ANALYST_SQL)
|
|
||||||
analyst = int(cur.fetchone()[0] or 0)
|
|
||||||
cur.execute(INGEST_SQL)
|
|
||||||
ingest = int(cur.fetchone()[0] or 0)
|
|
||||||
finally:
|
|
||||||
conn.close()
|
|
||||||
return analyst, ingest
|
|
||||||
|
|
||||||
|
|
||||||
def ensure_fresh() -> None:
|
|
||||||
now = time.time()
|
|
||||||
with _lock:
|
|
||||||
if now - _state["last_attempt"] < CACHE_TTL:
|
|
||||||
return
|
|
||||||
_state["last_attempt"] = now
|
|
||||||
try:
|
|
||||||
analyst, ingest = collect()
|
|
||||||
except Exception as exc: # noqa: BLE001 - never kill the endpoint
|
|
||||||
with _lock:
|
|
||||||
_state["up"] = 0
|
|
||||||
LOG.warning("collect failed: %s", exc)
|
|
||||||
return
|
|
||||||
with _lock:
|
|
||||||
_state.update(analyst=analyst, ingest=ingest, up=1)
|
|
||||||
|
|
||||||
|
|
||||||
def render() -> str:
|
|
||||||
with _lock:
|
|
||||||
analyst = _state["analyst"]
|
|
||||||
ingest = _state["ingest"]
|
|
||||||
up = _state["up"]
|
|
||||||
return (
|
|
||||||
"# HELP osint_analyst_last_success_timestamp_seconds "
|
|
||||||
"Epoch of the newest article_summaries.batch_timestamp (last brief "
|
|
||||||
"written by the analyst); 0 = no row.\n"
|
|
||||||
"# TYPE osint_analyst_last_success_timestamp_seconds gauge\n"
|
|
||||||
f"osint_analyst_last_success_timestamp_seconds {analyst}\n"
|
|
||||||
"# HELP osint_ingest_last_article_timestamp_seconds "
|
|
||||||
"Epoch of the newest articles.timestamp (last row ingested by the "
|
|
||||||
"scraper); 0 = no row.\n"
|
|
||||||
"# TYPE osint_ingest_last_article_timestamp_seconds gauge\n"
|
|
||||||
f"osint_ingest_last_article_timestamp_seconds {ingest}\n"
|
|
||||||
"# HELP osint_analyst_exporter_up 1 when the last database read "
|
|
||||||
"succeeded.\n"
|
|
||||||
"# TYPE osint_analyst_exporter_up gauge\n"
|
|
||||||
f"osint_analyst_exporter_up {up}\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Handler(BaseHTTPRequestHandler):
|
|
||||||
server_version = "osint-analyst-exporter/1.0"
|
|
||||||
|
|
||||||
def do_GET(self): # noqa: N802 - BaseHTTPRequestHandler API
|
|
||||||
path = self.path.split("?", 1)[0]
|
|
||||||
if path not in ("/metrics", "/healthz"):
|
|
||||||
self.send_error(404)
|
|
||||||
return
|
|
||||||
ensure_fresh()
|
|
||||||
body = render().encode()
|
|
||||||
self.send_response(200)
|
|
||||||
self.send_header("Content-Type", "text/plain; version=0.0.4; charset=utf-8")
|
|
||||||
self.send_header("Content-Length", str(len(body)))
|
|
||||||
self.end_headers()
|
|
||||||
self.wfile.write(body)
|
|
||||||
|
|
||||||
def log_message(self, fmt, *args): # noqa: A003 - stdlib hook
|
|
||||||
LOG.debug("%s - %s", self.address_string(), fmt % args)
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
# Prime the cache so the first scrape has data, but never refuse to
|
|
||||||
# start on a database blip.
|
|
||||||
ensure_fresh()
|
|
||||||
server = ThreadingHTTPServer(("0.0.0.0", PORT), Handler)
|
|
||||||
LOG.info("listening on 0.0.0.0:%s (db=%s/%s)", PORT, DB_CONFIG["host"], DB_CONFIG["dbname"])
|
|
||||||
server.serve_forever()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: osint-analyst-exporter
|
|
||||||
namespace: osint
|
|
||||||
labels:
|
|
||||||
app: osint-analyst-exporter
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: osint-analyst-exporter
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: osint-analyst-exporter
|
|
||||||
spec:
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: forgejo-pull
|
|
||||||
# Same placement policy as the other stateless amd64 loops here: prefer
|
|
||||||
# linode (where osint-db runs) but do not strand if it is absent.
|
|
||||||
nodeSelector:
|
|
||||||
kubernetes.io/arch: amd64
|
|
||||||
affinity:
|
|
||||||
nodeAffinity:
|
|
||||||
preferredDuringSchedulingIgnoredDuringExecution:
|
|
||||||
- weight: 100
|
|
||||||
preference:
|
|
||||||
matchExpressions:
|
|
||||||
- key: kubernetes.io/hostname
|
|
||||||
operator: In
|
|
||||||
values:
|
|
||||||
- linode
|
|
||||||
securityContext:
|
|
||||||
runAsNonRoot: true
|
|
||||||
runAsUser: 1000
|
|
||||||
runAsGroup: 1000
|
|
||||||
seccompProfile:
|
|
||||||
type: RuntimeDefault
|
|
||||||
containers:
|
|
||||||
- name: exporter
|
|
||||||
# Pinned summarizer image: python3 + psycopg2, see header comment.
|
|
||||||
# Kept equal to the summarizer pin in news-summarizer-deployment.yaml.
|
|
||||||
image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-fb5285df7f38
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
command: ["python", "/opt/exporter/exporter.py"]
|
|
||||||
env:
|
|
||||||
- name: PYTHONDONTWRITEBYTECODE
|
|
||||||
value: "1"
|
|
||||||
- name: EXPORTER_PORT
|
|
||||||
value: "9187"
|
|
||||||
- name: DB_HOST
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: osint-env
|
|
||||||
key: DB_HOST
|
|
||||||
- name: DB_PORT
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: osint-env
|
|
||||||
key: DB_PORT
|
|
||||||
- name: DB_NAME
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: osint-env
|
|
||||||
key: DB_NAME
|
|
||||||
- name: DB_USER
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: osint-env
|
|
||||||
key: DB_USER
|
|
||||||
- name: DB_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: osint-db
|
|
||||||
key: password
|
|
||||||
ports:
|
|
||||||
- name: metrics
|
|
||||||
containerPort: 9187
|
|
||||||
protocol: TCP
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /healthz
|
|
||||||
port: metrics
|
|
||||||
periodSeconds: 10
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /healthz
|
|
||||||
port: metrics
|
|
||||||
initialDelaySeconds: 10
|
|
||||||
periodSeconds: 30
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 10m
|
|
||||||
memory: 64Mi
|
|
||||||
limits:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 128Mi
|
|
||||||
securityContext:
|
|
||||||
allowPrivilegeEscalation: false
|
|
||||||
readOnlyRootFilesystem: true
|
|
||||||
capabilities:
|
|
||||||
drop:
|
|
||||||
- ALL
|
|
||||||
volumeMounts:
|
|
||||||
- name: script
|
|
||||||
mountPath: /opt/exporter
|
|
||||||
readOnly: true
|
|
||||||
volumes:
|
|
||||||
- name: script
|
|
||||||
configMap:
|
|
||||||
name: osint-analyst-exporter
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: osint-analyst-exporter
|
|
||||||
namespace: osint
|
|
||||||
labels:
|
|
||||||
app: osint-analyst-exporter
|
|
||||||
spec:
|
|
||||||
type: ClusterIP
|
|
||||||
selector:
|
|
||||||
app: osint-analyst-exporter
|
|
||||||
ports:
|
|
||||||
- name: metrics
|
|
||||||
port: 9187
|
|
||||||
targetPort: metrics
|
|
||||||
protocol: TCP
|
|
||||||
---
|
|
||||||
# Prometheus (monitoring ns) scrapes this; the ServiceMonitor selector is
|
|
||||||
# namespace-wide (spec.serviceMonitorNamespaceSelector = {}), so the label is
|
|
||||||
# what matters. Ingress from monitoring to :9187 is opened in networkpolicy.yaml.
|
|
||||||
apiVersion: monitoring.coreos.com/v1
|
|
||||||
kind: ServiceMonitor
|
|
||||||
metadata:
|
|
||||||
name: osint-analyst-exporter
|
|
||||||
namespace: osint
|
|
||||||
labels:
|
|
||||||
release: kube-prometheus-stack
|
|
||||||
spec:
|
|
||||||
namespaceSelector:
|
|
||||||
matchNames:
|
|
||||||
- osint
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: osint-analyst-exporter
|
|
||||||
endpoints:
|
|
||||||
- port: metrics
|
|
||||||
path: /metrics
|
|
||||||
interval: 30s
|
|
||||||
scrapeTimeout: 10s
|
|
||||||
|
|
@ -66,25 +66,14 @@ data:
|
||||||
# never see https here: this flag is what puts `Secure` on the session cookie.
|
# never see https here: this flag is what puts `Secure` on the session cookie.
|
||||||
ADMIN_COOKIE_SECURE: "1"
|
ADMIN_COOKIE_SECURE: "1"
|
||||||
|
|
||||||
# ── news summarizer (analyst) — Nous Portal ─────────────────────────────
|
# ── news summarizer (analyst) — Nous Portal, free tier model ────────────
|
||||||
NOUS_BASE_URL: https://inference-api.nousresearch.com/v1
|
NOUS_BASE_URL: https://inference-api.nousresearch.com/v1
|
||||||
# Meituan LongCat was retired from the portal (every call 404'd from 11/25
|
SUMMARY_MODEL: meituan/longcat-2.5:free
|
||||||
# onward, silently producing no briefs). The :free ids now require a user
|
|
||||||
# tag and 503 anyway; pin the cheapest model that answers normally and
|
|
||||||
# honours response_format: json_object (~$0.03/$0.12 per Mtok).
|
|
||||||
SUMMARY_MODEL: deepseek/deepseek-v4.1-flash-1017
|
|
||||||
# 4, not the upstream default 50: the map phase runs with a hard 60 s httpx
|
# 4, not the upstream default 50: the map phase runs with a hard 60 s httpx
|
||||||
# timeout (news/summerizer/nous_client.py, json_mode=False), so bigger
|
# timeout (news/summerizer/nous_client.py, json_mode=False), and this free
|
||||||
# batches risk timing out and silently contributing nothing to the reduce
|
# model needs ~30 s for 8 articles, so bigger batches time out and silently
|
||||||
# phase.
|
# contribute nothing to the reduce phase.
|
||||||
BATCH_SIZE: "4"
|
BATCH_SIZE: "4"
|
||||||
# Map-phase fan-out (PR #72). Each map call is a ~20 s wall clock, so the
|
|
||||||
# phase is latency-bound, not CPU-bound: the 746-batch recap measured 951 s
|
|
||||||
# end-to-end at 16 in flight, where 8 is projected at ~98 min. 16 is also the
|
|
||||||
# summarizer's DEFAULT_SUMMARY_MAP_CONCURRENCY; it is pinned here so a future
|
|
||||||
# code default change cannot silently stretch the 15-min interval past its
|
|
||||||
# window.
|
|
||||||
SUMMARY_MAP_CONCURRENCY: "16"
|
|
||||||
# Map-phase grading (PR #53): the map call scores every article 0-100 against
|
# Map-phase grading (PR #53): the map call scores every article 0-100 against
|
||||||
# a rubric and only blocks >= SUMMARY_MIN_SCORE reach the brief. When nothing
|
# a rubric and only blocks >= SUMMARY_MIN_SCORE reach the brief. When nothing
|
||||||
# clears the bar the top SUMMARY_FALLBACK_TOP are used so the HUD is not blank
|
# clears the bar the top SUMMARY_FALLBACK_TOP are used so the HUD is not blank
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,7 @@ resources:
|
||||||
- titiler-service.yaml
|
- titiler-service.yaml
|
||||||
- news-scraper-deployment.yaml
|
- news-scraper-deployment.yaml
|
||||||
- news-summarizer-deployment.yaml
|
- news-summarizer-deployment.yaml
|
||||||
# Freshness exporter for the analyst (max(article_summaries.batch_timestamp)
|
|
||||||
# and max(articles.timestamp) -> :9187/metrics) + its ServiceMonitor. The
|
|
||||||
# summarizer has no /metrics and a wedged analyst is invisible otherwise
|
|
||||||
# (card t_22334588).
|
|
||||||
- analyst-exporter.yaml
|
|
||||||
- httproute.yaml
|
- httproute.yaml
|
||||||
# Default-deny ingress+egress + the namespace allow list (audit F3 / t_fed52919).
|
|
||||||
- networkpolicy.yaml
|
|
||||||
# exec-only RBAC so forgejo/cluster-backup can pg_dump this namespace's plain
|
# exec-only RBAC so forgejo/cluster-backup can pg_dump this namespace's plain
|
||||||
# Postgres Deployment (osint-db) — not a CNPG cluster, so it needs its own path.
|
# Postgres Deployment (osint-db) — not a CNPG cluster, so it needs its own path.
|
||||||
- backup-exec-rbac.yaml
|
- backup-exec-rbac.yaml
|
||||||
|
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
# Tenant isolation for `osint` (audit finding F3 / A5-1, card t_fed52919).
|
|
||||||
#
|
|
||||||
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) makes
|
|
||||||
# every pod in this namespace reachable by nothing and able to reach nothing.
|
|
||||||
# `osint-allow` (CiliumNetworkPolicy) re-adds the traffic the workload actually
|
|
||||||
# uses, in both directions:
|
|
||||||
# ingress: the Cilium Gateway proxy (`reserved:ingress`) for
|
|
||||||
# osint.siriusdevops.com -> app:8000 / titiler:8000, plus node/health
|
|
||||||
# entities for kubelet probes.
|
|
||||||
# egress: cluster DNS, its own pods (app -> osint-db:5432, -> nats:4222,
|
|
||||||
# -> titiler:8000), and `world` — the ingester/news-scraper/
|
|
||||||
# news-summarizer fetch external news + Nominatim
|
|
||||||
# (nominatim.openstreetmap.org) + the Nous inference API, and
|
|
||||||
# camera-service reads RTSP cameras on the LAN.
|
|
||||||
#
|
|
||||||
# `world` in Cilium is everything outside the cluster (internet, LAN, VPN peers)
|
|
||||||
# but NOT other namespaces' pods and NOT the node IPs — so cross-namespace
|
|
||||||
# reachability and the internal WireGuard gateway ports stay closed.
|
|
||||||
#
|
|
||||||
# Deliberately absent:
|
|
||||||
# * kube-apiserver egress — no workload here calls the API; the audit's
|
|
||||||
# `SA token mounted` observation is a separate finding and denying the path
|
|
||||||
# does not depend on removing the token.
|
|
||||||
# * monitoring ingress — apart from the one port-scoped rule for the analyst
|
|
||||||
# freshness exporter below (Prometheus -> osint-analyst-exporter:9187),
|
|
||||||
# nothing in `monitoring` reaches this namespace.
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: NetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: default-deny
|
|
||||||
namespace: osint
|
|
||||||
spec:
|
|
||||||
podSelector: {}
|
|
||||||
policyTypes:
|
|
||||||
- Ingress
|
|
||||||
- Egress
|
|
||||||
---
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: osint-allow
|
|
||||||
namespace: osint
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
osint: gateway + kubelet ingress; egress to own namespace, cluster DNS and
|
|
||||||
the public internet only.
|
|
||||||
endpointSelector: {}
|
|
||||||
ingress:
|
|
||||||
- fromEntities:
|
|
||||||
- ingress
|
|
||||||
- host
|
|
||||||
- remote-node
|
|
||||||
- health
|
|
||||||
# Intra-namespace pod -> pod (app -> db, sidecars, the backup CronJob).
|
|
||||||
# Cilium enforces policy at BOTH ends, so this allow must exist in ingress as
|
|
||||||
# well as egress — measured on `piedmont`: with only the egress rule a pod
|
|
||||||
# could not reach its own Service (TimeoutError).
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: osint
|
|
||||||
# Prometheus (namespace `monitoring`) scrapes the analyst freshness exporter
|
|
||||||
# on 9187 (apps/base/osint/analyst-exporter.yaml). Port-scoped: no other
|
|
||||||
# monitoring -> osint traffic is opened.
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: monitoring
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "9187"
|
|
||||||
protocol: TCP
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: osint
|
|
||||||
# Internet / LAN / VPN peers: news sources, Nominatim, inference API, RTSP.
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
|
|
@ -39,12 +39,7 @@ spec:
|
||||||
kubernetes.io/arch: amd64
|
kubernetes.io/arch: amd64
|
||||||
containers:
|
containers:
|
||||||
- name: news-summarizer
|
- name: news-summarizer
|
||||||
# amd64-fb5285df7f38 = sirius/osint-dashboard@fb5285d (PR #72, merged):
|
image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-fe2b5df369d0
|
||||||
# the map phase runs concurrently (SUMMARY_MAP_CONCURRENCY) and a
|
|
||||||
# non-retryable Nous rejection raises NousAPIError instead of being
|
|
||||||
# swallowed, so a wedged analyst fails loudly instead of idling for
|
|
||||||
# nine days on silent empty completions (card t_22334588 / t_2ae9f0c0).
|
|
||||||
image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-fb5285df7f38
|
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
# Loop: batch the last window, call Nous Portal, write summaries.
|
# Loop: batch the last window, call Nous Portal, write summaries.
|
||||||
command: ["python", "run_news_summarizer.py"]
|
command: ["python", "run_news_summarizer.py"]
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ resources:
|
||||||
- service.yaml
|
- service.yaml
|
||||||
- service-api.yaml
|
- service-api.yaml
|
||||||
- httproute.yaml
|
- httproute.yaml
|
||||||
# Default-deny ingress+egress + the namespace allow list (audit F3 / t_fed52919).
|
|
||||||
- networkpolicy.yaml
|
|
||||||
# Secrets, SOPS/age-encrypted in git. Flux decrypts them (the `apps`
|
# Secrets, SOPS/age-encrypted in git. Flux decrypts them (the `apps`
|
||||||
# Kustomization carries a decryption block; key = flux-system/sops-age).
|
# Kustomization carries a decryption block; key = flux-system/sops-age).
|
||||||
# Never add a plaintext Secret next to these — see docs/secrets-sops.md.
|
# Never add a plaintext Secret next to these — see docs/secrets-sops.md.
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
# Tenant isolation for `piedmont` (audit finding F3 / A5-1, card t_fed52919).
|
|
||||||
#
|
|
||||||
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the
|
|
||||||
# deny. `piedmont-allow` (CiliumNetworkPolicy) re-adds:
|
|
||||||
# ingress: the Cilium Gateway proxy (`reserved:ingress`) for
|
|
||||||
# piedmonthomesvc.com -> site:80 / contact:8090, plus node/health
|
|
||||||
# entities for kubelet probes.
|
|
||||||
# egress: cluster DNS; its own pods (nginx may proxy /api/contact in-namespace);
|
|
||||||
# and `world` for the Telegram Bot API used by piedmont-contact.
|
|
||||||
#
|
|
||||||
# `world` is everything outside the cluster (internet, LAN, VPN peers) but not
|
|
||||||
# other namespaces' pods and not node IPs, so the tenant boundary holds.
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: NetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: default-deny
|
|
||||||
namespace: piedmont
|
|
||||||
spec:
|
|
||||||
podSelector: {}
|
|
||||||
policyTypes:
|
|
||||||
- Ingress
|
|
||||||
- Egress
|
|
||||||
---
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: piedmont-allow
|
|
||||||
namespace: piedmont
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
piedmont: gateway + kubelet ingress; egress to own namespace, cluster DNS
|
|
||||||
and the public internet only.
|
|
||||||
endpointSelector: {}
|
|
||||||
ingress:
|
|
||||||
- fromEntities:
|
|
||||||
- ingress
|
|
||||||
- host
|
|
||||||
- remote-node
|
|
||||||
- health
|
|
||||||
# Intra-namespace: nginx -> contact (and any future pod -> pod call). Cilium
|
|
||||||
# enforces policy at BOTH ends, so the same-namespace allow must exist in
|
|
||||||
# ingress as well as egress — measured: with only the egress rule, a pod in
|
|
||||||
# this namespace could not reach its own Service (TimeoutError).
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: piedmont
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: piedmont
|
|
||||||
# Telegram Bot API (contact form delivery).
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
|
|
@ -14,12 +14,6 @@ resources:
|
||||||
- service-blog.yaml
|
- service-blog.yaml
|
||||||
- service-portal-gate.yaml
|
- service-portal-gate.yaml
|
||||||
- httproute.yaml
|
- httproute.yaml
|
||||||
# Default-deny ingress+egress + the namespace allow list (audit F3 / t_fed52919).
|
|
||||||
- networkpolicy.yaml
|
|
||||||
# Egress lockdown for the leadgen-backup pod: DNS + 10.10.0.5:22 only. The
|
|
||||||
# allow list above cannot be narrowed per pod, so the deny for `world` in
|
|
||||||
# this policy is what applies to the job (card t_9d0428d8).
|
|
||||||
- networkpolicy-backup.yaml
|
|
||||||
# The WAL archive store must exist before the Cluster references it.
|
# The WAL archive store must exist before the Cluster references it.
|
||||||
- objectstore-portal-wal.yaml
|
- objectstore-portal-wal.yaml
|
||||||
- cluster.yaml
|
- cluster.yaml
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ data:
|
||||||
# Snapshot mirror of /src -> $BACKUP_DIR/leadgen-data/<stamp>/ + `latest`.
|
# Snapshot mirror of /src -> $BACKUP_DIR/leadgen-data/<stamp>/ + `latest`.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# No package install here on purpose: rsync/openssh-client/bash are baked
|
if ! command -v rsync >/dev/null || ! command -v ssh >/dev/null; then
|
||||||
# into the pinned image (images/backup/Dockerfile) and this pod's egress
|
echo "== installing rsync + openssh-client"
|
||||||
# policy admits DNS + 10.10.0.5:22 only, so a runtime fetch would fail
|
apk add --no-cache rsync openssh-client >/dev/null
|
||||||
# rather than silently dial the Alpine CDN (card t_9d0428d8).
|
fi
|
||||||
|
|
||||||
BACKUP_HOST=${BACKUP_HOST:[email protected]}
|
BACKUP_HOST=${BACKUP_HOST:[email protected]}
|
||||||
BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup}
|
BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup}
|
||||||
|
|
@ -102,18 +102,12 @@ spec:
|
||||||
app: leadgen-backup
|
app: leadgen-backup
|
||||||
spec:
|
spec:
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
# Pulled from the in-cluster Forgejo registry (which requires auth).
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: forgejo-pull
|
|
||||||
# The PVC is local-path on siriussec.
|
# The PVC is local-path on siriussec.
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: siriussec
|
kubernetes.io/hostname: siriussec
|
||||||
containers:
|
containers:
|
||||||
- name: backup
|
- name: backup
|
||||||
# rsync + openssh-client + bash baked at build time, pinned by
|
image: alpine/k8s:1.36.4
|
||||||
# digest (images/backup/Dockerfile). Nothing is installed at run
|
|
||||||
# time.
|
|
||||||
image: forgejo.siriusdevops.com/sirius/backup-tools@sha256:cc8dc1645111b3a80b7c4d5168f6bce3002cae7417b3725683c057976f6e379a
|
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command: ["/bin/bash", "/scripts/backup.sh"]
|
command: ["/bin/bash", "/scripts/backup.sh"]
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
# Egress lockdown for the nightly leadgen-backup CronJob (card t_9d0428d8).
|
|
||||||
#
|
|
||||||
# Why: the job used to `apk add --no-cache rsync openssh-client` at container
|
|
||||||
# start, so each run depended on the Alpine CDN (Fastly 151.101.x.132:443).
|
|
||||||
# rsync/ssh/bash (+kubectl, unused here) are baked into
|
|
||||||
# images/backup/Dockerfile now.
|
|
||||||
#
|
|
||||||
# `sirius-growth-allow` (networkpolicy.yaml) selects every pod in this
|
|
||||||
# namespace and allows `world` (Telegram Bot API, the leadgen crawlers), so a
|
|
||||||
# pod-scoped allow list alone would NOT restrict this job — Cilium unions
|
|
||||||
# policies. The `egressDeny` for `world` closes it for this pod only; the app
|
|
||||||
# pods keep their internet access.
|
|
||||||
#
|
|
||||||
# Allow list, and nothing else: cluster DNS, and [email protected]:22 (the Linode
|
|
||||||
# node's InternalIP — `remote-node`, not `world`) for the rsync mirror.
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: leadgen-backup-egress
|
|
||||||
namespace: sirius-growth
|
|
||||||
labels:
|
|
||||||
app: leadgen-backup
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
leadgen-backup pod: cluster DNS + SSH to the backup host (10.10.0.5:22)
|
|
||||||
only; no internet egress at run time.
|
|
||||||
endpointSelector:
|
|
||||||
matchLabels:
|
|
||||||
app: leadgen-backup
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEntities:
|
|
||||||
- remote-node
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "22"
|
|
||||||
protocol: TCP
|
|
||||||
egressDeny:
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
||||||
# Tenant isolation for `sirius-growth` (audit finding F3 / A5-1, card t_fed52919).
|
|
||||||
#
|
|
||||||
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the
|
|
||||||
# deny. `sirius-growth-allow` (CiliumNetworkPolicy) re-adds what the namespace
|
|
||||||
# actually uses:
|
|
||||||
# ingress: Cilium Gateway proxy (`reserved:ingress`) for
|
|
||||||
# siriusgrowthsolutions.com -> site:80 / contact:8090 /
|
|
||||||
# portal-gate:8080 / portal:8091 / blog:8092, node entities for
|
|
||||||
# kubelet probes, Prometheus in `monitoring` on 9187 only (the
|
|
||||||
# `cnpg-portal` PodMonitor scrapes the CNPG instance manager), and
|
|
||||||
# the CNPG operator in `cnpg-system` on 8000 only — the instance
|
|
||||||
# manager's HTTPS status endpoint the operator reads to derive the
|
|
||||||
# system ID and drive failover (card t_4210edec).
|
|
||||||
# egress: cluster DNS; its own pods (blog/portal -> portal-1:5432,
|
|
||||||
# portal-gate -> portal:8091); `world` for the Telegram Bot API
|
|
||||||
# (contact + portal) and the leadgen crawlers; the node IPs on 3900
|
|
||||||
# (Garage S3: 10.10.0.1 for blog/portal media, 10.10.0.5 for the
|
|
||||||
# portal WAL ObjectStore) and on 22 (leadgen-backup rsyncs to
|
|
||||||
# [email protected]); and `kube-apiserver` for the CNPG instance
|
|
||||||
# manager, which needs the API for leader/status updates.
|
|
||||||
#
|
|
||||||
# Garage lives on node IPs, which Cilium maps to `reserved:remote-node`, not
|
|
||||||
# `world` — see apps/base/siriusdevops/networkpolicy.yaml for the original
|
|
||||||
# measurement (an `ipBlock`/toCIDR rule for 10.10.0.1 is silently inert here).
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: NetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: default-deny
|
|
||||||
namespace: sirius-growth
|
|
||||||
spec:
|
|
||||||
podSelector: {}
|
|
||||||
policyTypes:
|
|
||||||
- Ingress
|
|
||||||
- Egress
|
|
||||||
---
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: sirius-growth-allow
|
|
||||||
namespace: sirius-growth
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
sirius-growth: gateway + kubelet + Prometheus ingress; egress to own
|
|
||||||
namespace, cluster DNS, the internet, Garage/SSH on node IPs and the API.
|
|
||||||
endpointSelector: {}
|
|
||||||
ingress:
|
|
||||||
- fromEntities:
|
|
||||||
- ingress
|
|
||||||
- host
|
|
||||||
- remote-node
|
|
||||||
- health
|
|
||||||
# Intra-namespace pod -> pod (app -> db, sidecars, the backup CronJob).
|
|
||||||
# Cilium enforces policy at BOTH ends, so this allow must exist in ingress as
|
|
||||||
# well as egress — measured on `piedmont`: with only the egress rule a pod
|
|
||||||
# could not reach its own Service (TimeoutError).
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: sirius-growth
|
|
||||||
# The CNPG operator (`cnpg-system`) reads the instance manager's HTTPS
|
|
||||||
# status endpoint to derive the system ID and drive switchover/promotion.
|
|
||||||
# Without it the Cluster reports `Instance Status Extraction Error` and
|
|
||||||
# Ready=False while the pods serve traffic, and automated failover is dead
|
|
||||||
# (card t_4210edec). Scoped to 8000: not 5432, not the whole namespace.
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: cnpg-system
|
|
||||||
app.kubernetes.io/name: cloudnative-pg
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "8000"
|
|
||||||
protocol: TCP
|
|
||||||
# Prometheus scrapes the CNPG `portal` instance manager on 9187.
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: monitoring
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "9187"
|
|
||||||
protocol: TCP
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: sirius-growth
|
|
||||||
# Telegram Bot API + leadgen crawl targets.
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
# Garage S3 on the Pi (10.10.0.1) and the Linode (10.10.0.5); leadgen-backup
|
|
||||||
# SSH/rsync to [email protected]. Node IPs are `remote-node`, not `world`.
|
|
||||||
- toEntities:
|
|
||||||
- remote-node
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "3900"
|
|
||||||
protocol: TCP
|
|
||||||
- port: "22"
|
|
||||||
protocol: TCP
|
|
||||||
# CNPG instance manager <-> kube-apiserver. Port-scoped on purpose: the
|
|
||||||
# apiserver is host-networked on 10.10.0.2, and Cilium attaches the
|
|
||||||
# `kube-apiserver` identity to that whole node IP — an unscoped entity rule
|
|
||||||
# also opens 8081/8084/8085/8086/8087 (the internal Gateway listeners) and
|
|
||||||
# :10250/:9100 on the same address. Measured: 10.10.0.2:8085 was OPEN from
|
|
||||||
# this namespace until the ports were named. 443 is the service port the
|
|
||||||
# CNPG instance manager dials (kubernetes.default:443 -> backend 6443).
|
|
||||||
- toEntities:
|
|
||||||
- kube-apiserver
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "6443"
|
|
||||||
protocol: TCP
|
|
||||||
- port: "443"
|
|
||||||
protocol: TCP
|
|
||||||
|
|
@ -77,7 +77,7 @@ spec:
|
||||||
memory: 128Mi
|
memory: 128Mi
|
||||||
containers:
|
containers:
|
||||||
- name: nginx
|
- name: nginx
|
||||||
image: forgejo.siriusdevops.com/sirius/siriusdevops-site:3ac9870aa7637cffb789edcc16b9512d7567886d
|
image: forgejo.siriusdevops.com/sirius/siriusdevops-site:399c421f51a2fd74a87e810641226d58e4e22690
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,7 @@ resources:
|
||||||
- service-site.yaml
|
- service-site.yaml
|
||||||
- service-api.yaml
|
- service-api.yaml
|
||||||
- httproute.yaml
|
- httproute.yaml
|
||||||
# Replaces the egress-only `siriusdevops-site-egress` CNP: same Garage +
|
- networkpolicy-site-egress.yaml
|
||||||
# DNS allow, plus a namespace-wide default-deny and ingress rules (F3).
|
|
||||||
- networkpolicy.yaml
|
|
||||||
# Secrets, SOPS/age-encrypted in git. Flux decrypts them (the `apps`
|
# Secrets, SOPS/age-encrypted in git. Flux decrypts them (the `apps`
|
||||||
# Kustomization carries a decryption block; key = flux-system/sops-age).
|
# Kustomization carries a decryption block; key = flux-system/sops-age).
|
||||||
# Never add a plaintext Secret next to these — see docs/secrets-sops.md.
|
# Never add a plaintext Secret next to these — see docs/secrets-sops.md.
|
||||||
|
|
|
||||||
70
apps/base/siriusdevops/networkpolicy-site-egress.yaml
Normal file
70
apps/base/siriusdevops/networkpolicy-site-egress.yaml
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
# Egress policy for the public site pod — the first policy in this namespace
|
||||||
|
# (there were zero before 2026-11-19, so every pod could reach every WireGuard
|
||||||
|
# address).
|
||||||
|
#
|
||||||
|
# What it is for: `siriusdevops-site` runs an initContainer that pulls owner
|
||||||
|
# media out of the private Garage bucket over the mesh
|
||||||
|
# (http://10.10.0.1:3900). Nothing else about that pod needs to talk to the
|
||||||
|
# WireGuard network, and the pod is internet-facing, so it is the right first
|
||||||
|
# pod to fence off.
|
||||||
|
#
|
||||||
|
# WHY A CiliumNetworkPolicy AND NOT A networking.k8s.io NetworkPolicy:
|
||||||
|
# 10.10.0.1 is a CLUSTER NODE (rpi, the WireGuard hub), not a bare address.
|
||||||
|
# Cilium resolves it to `reserved:remote-node` (identity 6) in its ipcache
|
||||||
|
# (`cilium-dbg bpf ipcache list | grep 10.10.0.1` -> identity=6), and `ipBlock`
|
||||||
|
# / toCIDR rules are only evaluated for `reserved:world`. A standard
|
||||||
|
# NetworkPolicy with `ipBlock: 10.10.0.1/32` is silently inert here — measured:
|
||||||
|
# the pod's request to 10.10.0.1:3900 timed out exactly like the denied ports,
|
||||||
|
# while Prometheus (unrestricted namespace) scraped the same host fine.
|
||||||
|
#
|
||||||
|
# The narrower `toNodes: [{matchLabels: {kubernetes.io/hostname: rpi}}]` form
|
||||||
|
# would name the node exactly, but the agent rejects it unless Cilium runs with
|
||||||
|
# `enable-node-selector-labels: true` — status: "FromNodes/ToNodes rules can
|
||||||
|
# only be applied when the \"enable-node-selector-labels\" flag is set". Rather
|
||||||
|
# than change a cluster-wide Cilium flag for one policy, this uses the
|
||||||
|
# `remote-node` entity: any cluster node, TCP 3900 only. Every cluster node is
|
||||||
|
# on the WireGuard overlay, so this still cannot reach the LAN or the public
|
||||||
|
# internet, and the port scope is what makes the denial test meaningful.
|
||||||
|
#
|
||||||
|
# Scope: Egress only, one pod selector. Other pods in siriusdevops (and every
|
||||||
|
# other namespace) remain unrestricted — this proves the pattern, it is not
|
||||||
|
# namespace segregation. Ingress is untouched: the Cilium Gateway must still be
|
||||||
|
# able to reach nginx on :80.
|
||||||
|
#
|
||||||
|
# The policy is a whitelist: once it selects a pod, ALL egress from that pod is
|
||||||
|
# denied except what is listed. Two allowances:
|
||||||
|
# 1. TCP 3900 to a cluster node — Garage's S3 API on 10.10.0.1. Deliberately
|
||||||
|
# port-scoped: 10.10.0.1 also serves the container registry on 5000, and
|
||||||
|
# that stays unreachable from this pod.
|
||||||
|
# 2. Cluster DNS. Nothing in this pod resolves names today (the S3 endpoint
|
||||||
|
# is a literal IP); the rule costs one line and removes the trap of
|
||||||
|
# breaking name resolution in a pod that later grows a container.
|
||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: siriusdevops-site-egress
|
||||||
|
namespace: siriusdevops
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: siriusdevops-site
|
||||||
|
egress:
|
||||||
|
# Garage S3 API, on a WireGuard-overlay node, port 3900 only.
|
||||||
|
- toEntities:
|
||||||
|
- remote-node
|
||||||
|
toPorts:
|
||||||
|
- ports:
|
||||||
|
- port: "3900"
|
||||||
|
protocol: TCP
|
||||||
|
|
||||||
|
# Cluster DNS (CoreDNS) only.
|
||||||
|
- toEndpoints:
|
||||||
|
- matchLabels:
|
||||||
|
io.kubernetes.pod.namespace: kube-system
|
||||||
|
k8s-app: kube-dns
|
||||||
|
toPorts:
|
||||||
|
- ports:
|
||||||
|
- port: "53"
|
||||||
|
protocol: UDP
|
||||||
|
- port: "53"
|
||||||
|
protocol: TCP
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
# Tenant isolation for `siriusdevops` (audit finding F3 / A5-1, card t_fed52919).
|
|
||||||
#
|
|
||||||
# Replaces the egress-only `siriusdevops-site-egress` CiliumNetworkPolicy. That
|
|
||||||
# policy proved the mechanism but restricted one pod in one direction; this file
|
|
||||||
# adds the namespace-wide deny and keeps the two allow rules that measurement
|
|
||||||
# established:
|
|
||||||
#
|
|
||||||
# WHY THE GARAGE RULE IS `remote-node` AND NOT `ipBlock`:
|
|
||||||
# 10.10.0.1 is a CLUSTER NODE (rpi, the WireGuard hub), not a bare address.
|
|
||||||
# Cilium resolves it to `reserved:remote-node` (identity 6) in its ipcache
|
|
||||||
# (`cilium-dbg bpf ipcache list | grep 10.10.0.1` -> identity=6), and
|
|
||||||
# `ipBlock`/toCIDR rules are only evaluated for `reserved:world`. A standard
|
|
||||||
# NetworkPolicy with `ipBlock: 10.10.0.1/32` is silently inert here — measured:
|
|
||||||
# the pod's request to 10.10.0.1:3900 timed out exactly like the denied ports,
|
|
||||||
# while Prometheus (unrestricted namespace) scraped the same host fine.
|
|
||||||
# `toNodes` would name the node exactly but needs Cilium's
|
|
||||||
# `enable-node-selector-labels` flag; the port-scoped `remote-node` entity gives
|
|
||||||
# the same reach (any cluster node is on the WireGuard overlay, TCP 3900 only)
|
|
||||||
# without a cluster-wide flag change.
|
|
||||||
#
|
|
||||||
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the
|
|
||||||
# deny. `siriusdevops-allow` (CiliumNetworkPolicy) re-adds:
|
|
||||||
# ingress: Cilium Gateway proxy (`reserved:ingress`) for siriusdevops.com ->
|
|
||||||
# site:80 / contact:8090, plus node/health entities for kubelet probes.
|
|
||||||
# egress: cluster DNS; its own pods; `world` for the Telegram Bot API used by
|
|
||||||
# siriusdevops-contact; node IPs on 3900 for the media pull the site
|
|
||||||
# runs in its initContainer (Garage S3, http://10.10.0.1:3900).
|
|
||||||
#
|
|
||||||
# Port 5000 (the container registry on the same node) stays unreachable from
|
|
||||||
# these pods, exactly as before.
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: NetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: default-deny
|
|
||||||
namespace: siriusdevops
|
|
||||||
spec:
|
|
||||||
podSelector: {}
|
|
||||||
policyTypes:
|
|
||||||
- Ingress
|
|
||||||
- Egress
|
|
||||||
---
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: siriusdevops-allow
|
|
||||||
namespace: siriusdevops
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
siriusdevops: gateway + kubelet ingress; egress to own namespace, cluster
|
|
||||||
DNS, the internet and Garage on node IPs (TCP 3900) only.
|
|
||||||
endpointSelector: {}
|
|
||||||
ingress:
|
|
||||||
- fromEntities:
|
|
||||||
- ingress
|
|
||||||
- host
|
|
||||||
- remote-node
|
|
||||||
- health
|
|
||||||
# Intra-namespace pod -> pod (app -> db, sidecars, the backup CronJob).
|
|
||||||
# Cilium enforces policy at BOTH ends, so this allow must exist in ingress as
|
|
||||||
# well as egress — measured on `piedmont`: with only the egress rule a pod
|
|
||||||
# could not reach its own Service (TimeoutError).
|
|
||||||
- fromEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: siriusdevops
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: siriusdevops
|
|
||||||
# Telegram Bot API (contact form delivery).
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
# Garage S3 API, on a WireGuard-overlay node, port 3900 only.
|
|
||||||
- toEntities:
|
|
||||||
- remote-node
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "3900"
|
|
||||||
protocol: TCP
|
|
||||||
|
|
@ -1,140 +0,0 @@
|
||||||
# Gateway access logging (cilium-envoy)
|
|
||||||
|
|
||||||
Source of truth for the HTTP access log the Cilium Gateway class emits. Closes finding F7 of the
|
|
||||||
2026-11-27 cluster netsec audit: before this, `cilium-envoy` wrote **no request-level record**, so the
|
|
||||||
design's application-layer detection (traversal / `union select` / `%00` / `.env`/`.git` probes,
|
|
||||||
high-rate 401-403 per client, scanner user agents) had no input stream.
|
|
||||||
|
|
||||||
## What is configured, and where it lives
|
|
||||||
|
|
||||||
| Object | File |
|
|
||||||
|---|---|
|
|
||||||
| `CiliumGatewayClassConfig kube-system/cilium` | `infrastructure/networking/gateway/gatewayclass-config.yaml` |
|
|
||||||
| `GatewayClass cilium` (+ `spec.parametersRef`) | `infrastructure/networking/gateway/gatewayclass.yaml` |
|
|
||||||
|
|
||||||
Cilium 1.20 reads `spec.telemetry.accessLogs` from the config referenced by
|
|
||||||
`GatewayClass.spec.parametersRef`. The cilium Helm chart creates the GatewayClass but has **no values
|
|
||||||
knob for `parametersRef`**, so the object is declared in Git with the chart's spec plus the reference;
|
|
||||||
Flux (`kustomization infrastructure`) owns both. Access logging therefore applies to **every** Gateway
|
|
||||||
on the `cilium` class: `gateway-system/public` and the internal `internal/*` Gateways.
|
|
||||||
|
|
||||||
Cilium renders the config into each Gateway listener's HTTP connection manager as an
|
|
||||||
`envoy.access_loggers.stdout` access log (`StdoutAccessLog`), i.e. one JSON line per request on the
|
|
||||||
`cilium-envoy` container's stdout. Nothing is applied by hand; `cilium upgrade` / `helm upgrade` must
|
|
||||||
not be used.
|
|
||||||
|
|
||||||
## Fields
|
|
||||||
|
|
||||||
`gateway, start_time, method, path, protocol, response_code, response_flags, duration_ms,
|
|
||||||
bytes_received, bytes_sent, authority, client_ip, x_forwarded_for, peer, user_agent, cf_ray,
|
|
||||||
upstream_host`
|
|
||||||
|
|
||||||
- `client_ip` = `CF-Connecting-IP`. Envoy is hostNetwork, so the **raw peer is cloudflared on the Pi**
|
|
||||||
(`10.10.0.1`) for public traffic and the WG client address for internal traffic — `peer` and
|
|
||||||
`x_forwarded_for` are kept so a missing/forged `CF-Connecting-IP` is visible rather than trusted.
|
|
||||||
Internal/WG requests have `client_ip: null` and a real `peer`.
|
|
||||||
- `authority` is the Host (which public hostname / which `10.10.0.2:<port>`).
|
|
||||||
- `path` is `X-ENVOY-ORIGINAL-PATH?:PATH`, so a rewrite does not hide the requested path.
|
|
||||||
|
|
||||||
**Not logged, by construction** (the JSON map is an allowlist, not a filter): no request/response
|
|
||||||
bodies and no header dumps, so `Authorization`, `Cookie` and `Set-Cookie` never reach disk. Envoy
|
|
||||||
application log level stays `info` — no debug/trace logging.
|
|
||||||
|
|
||||||
## Where the lines land
|
|
||||||
|
|
||||||
1. `/var/log/pods/kube-system_cilium-envoy-<suffix>_<uid>/cilium-envoy/*.log` (kubelet container log).
|
|
||||||
2. Loki automatically: the `logging` Alloy DaemonSet tails `/var/log/pods/*/*/*.log*`, so the stream
|
|
||||||
appears as `{namespace="kube-system", container="cilium-envoy", job="kube/pods", node="siriussec"}`
|
|
||||||
with the store's 192 h retention. No extra Alloy/Loki configuration was needed.
|
|
||||||
|
|
||||||
Only **siriussec** runs envoy (`node-role.kubernetes.io/gateway=true` is a single node), so there is
|
|
||||||
exactly one container log — the "3 nodes" framing in the finding does not apply.
|
|
||||||
|
|
||||||
## Measured volume and retention (2026-11-27)
|
|
||||||
|
|
||||||
Window `06:35:26Z → 06:55:04Z`, 1,178 s, live public traffic:
|
|
||||||
|
|
||||||
| Measure | Value |
|
|
||||||
|---|---|
|
|
||||||
| access lines | 11,240 |
|
|
||||||
| bytes written | 7,205,793 |
|
|
||||||
| per line | 641 B |
|
|
||||||
| line rate | 9.54/s |
|
|
||||||
| write rate | 6.1 KB/s |
|
|
||||||
| **projected** | **528 MB/day raw (504 MiB)** |
|
|
||||||
| 5-day request average (envoy `downstream_rq_total` 2,059,146 / 417,181 s = 4.94/s) | 274 MB/day |
|
|
||||||
| lines per request (594 s sub-window: +5,534 lines vs +5,492 requests) | 1.008 |
|
|
||||||
|
|
||||||
Composition: 93.5 % `forgejo.siriusdevops.com` (about half of those are 303 login redirects to
|
|
||||||
crawlers, because the registry/UI is login-only), 4.2 % hubble UI, 1.2 % the sites, 1.1 % bare-IP
|
|
||||||
internal ports.
|
|
||||||
|
|
||||||
**kubelet default rotation (10 MiB x 5 per container):** 10 MiB at 6.1 KB/s = **28.6 min per file**,
|
|
||||||
so the 5-file budget (50 MiB) holds **≈2.4 h** of access log at the measured rate (≈4.6 h at the 5-day
|
|
||||||
average). Hard disk cost is capped at 50 MiB — 0.023 % of siriussec's 213.5 GiB root (99 GiB free;
|
|
||||||
`/var/log/pods` is 66 MB total today). Not minutes-long, so the default is kept: Loki is the archive.
|
|
||||||
If a longer *file* window is ever wanted, `containerLogMaxSize: 50Mi` + `containerLogMaxFiles: 5`
|
|
||||||
(250 MiB/container, ≈7 h) in `/var/lib/kubelet/config.yaml` is the change — it is node-wide and needs
|
|
||||||
a kubelet restart, and at ~35 containers that is a worst case of ~8.6 GiB of logs inside 99 GiB free.
|
|
||||||
|
|
||||||
Loki cost: `gzip -6` of the captured window shrinks 8.1 MB → 0.64 MB (**12.6x**), so 528 MB/day raw is
|
|
||||||
≈42 MB/day stored, ≈340 MB for the full 192 h inside the 8 GiB `logging/loki-data` PVC.
|
|
||||||
|
|
||||||
## Verify
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# config accepted and bound
|
|
||||||
kubectl -n kube-system get ciliumgatewayclassconfig cilium # ACCEPTED True
|
|
||||||
kubectl get gatewayclass cilium -o jsonpath='{.spec.parametersRef}'
|
|
||||||
|
|
||||||
# the listener really carries the access log (host, because the container has no curl)
|
|
||||||
sudo curl -s --unix-socket /var/run/cilium/envoy/sockets/admin.sock \
|
|
||||||
http://localhost/config_dump | grep -o 'envoy.access_loggers.stdout' | head -1
|
|
||||||
|
|
||||||
# drive one request through the tunnel and read the line
|
|
||||||
curl -s -o /dev/null "https://siriusdevops.com/?probe=$(date +%s)"
|
|
||||||
sudo tail -1 /var/log/pods/kube-system_cilium-envoy-*/cilium-envoy/*.log*
|
|
||||||
```
|
|
||||||
|
|
||||||
A request that matches a Cloudflare cache HIT never reaches the origin and therefore produces no line —
|
|
||||||
add a query string when proving logging.
|
|
||||||
|
|
||||||
Rotation happens at 10 MiB. kubelet renames the full file to `<n>.log.<YYYYMMDD-HHMMSS>` (observed
|
|
||||||
2026-11-27T07:02:56Z: `3.log` 10,528,075 B -> `3.log.20261127-020256`, new `3.log` started, 29.3 min
|
|
||||||
after the first access line — the projection was 28.6 min) and starts a new `*.log`. The `*.log*`
|
|
||||||
glob in the commands above therefore covers rotated files too; a plain `*.log` would miss them.
|
|
||||||
|
|
||||||
## Parse
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# one line -> flat record; client_ip is the real client for tunnelled traffic
|
|
||||||
sudo grep -h '"authority"' /var/log/pods/kube-system_cilium-envoy-*/cilium-envoy/*.log* \
|
|
||||||
| sed 's/^.* stdout F //' \
|
|
||||||
| jq -c 'select(.gateway=="gateway-system/public")
|
|
||||||
| {ts:.start_time, host:.authority, method, path, code:.response_code,
|
|
||||||
client:(.client_ip//.peer), ua:.user_agent, ray:.cf_ray,
|
|
||||||
flags:.response_flags, ms:(.duration_ms|tonumber)}'
|
|
||||||
```
|
|
||||||
|
|
||||||
Example (client redacted to /24), real line from the proof request:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{"authority":"siriusdevops.com","bytes_received":0,"bytes_sent":30179,"cf_ray":"a60f1bb759b3d96c-ATL",
|
|
||||||
"client_ip":"137.118.156.0","duration_ms":1,"gateway":"gateway-system/public","method":"GET",
|
|
||||||
"path":"/?f7probe=1795761278","peer":"10.10.0.1","protocol":"HTTP/1.1","response_code":200,
|
|
||||||
"response_flags":"-","start_time":"2026-11-27T06:34:38.642Z","upstream_host":"10.244.0.60:80",
|
|
||||||
"user_agent":"curl/8.23.0","x_forwarded_for":"137.118.156.0,10.10.0.1"}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Operational notes
|
|
||||||
|
|
||||||
- **The change is an xDS push, not a restart.** `cilium-envoy` was not restarted and no listener was
|
|
||||||
rebound; the pod kept its original age/restart count through the change.
|
|
||||||
- **Nothing happens if the cilium-operator's gateway controller is not running.** It is the component
|
|
||||||
that reads `parametersRef` and rewrites the Gateway listeners. On 2026-11-27 it had failed to
|
|
||||||
initialise during an apiserver restart (`Required GatewayAPI resources are not found` — transient
|
|
||||||
RBAC lookup failure at 05:24Z) and stayed wedged, so a GatewayClassConfig change applied cleanly in
|
|
||||||
Git but produced no access log until `kubectl -n kube-system rollout restart deploy/cilium-operator`.
|
|
||||||
Always confirm `kubectl -n kube-system logs deploy/cilium-operator | grep Reconciling Gateway`.
|
|
||||||
- Rollback: revert the commit (or delete the `parametersRef`); the operator drops the access log on
|
|
||||||
the next Gateway reconcile. Nothing else in the chain depends on it.
|
|
||||||
|
|
@ -129,26 +129,17 @@ silent. So the sensor contract is:
|
||||||
|
|
||||||
> **A 30-minute window with any lost event may not be reported as clean.**
|
> **A 30-minute window with any lost event may not be reported as clean.**
|
||||||
|
|
||||||
The counter carries two different signals and the gate must not treat them
|
|
||||||
alike: `perf_event_ring_buffer` / `observer_events_queue` are real loss on the
|
|
||||||
way in, while `hubble_ring_buffer` also counts *reads* that fall outside the
|
|
||||||
ring's retained window (the artefact above). A read is not a lost event, so the
|
|
||||||
gate value is built from the two real-loss sources only, and read churn gets its
|
|
||||||
own rate-based regression guard.
|
|
||||||
|
|
||||||
Threshold and enforcement:
|
Threshold and enforcement:
|
||||||
|
|
||||||
| rule | expression | meaning |
|
| rule | expression | meaning |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `hubble:lost_events_increase_30m` (recorder) | `sum by (node, source) (increase(hubble_lost_events_total{source=~"perf_event_ring_buffer\|observer_events_queue"}[30m]))` | the gate value: any non-zero **real** loss → window incomplete; `source` is kept so the alert can name it |
|
| `hubble:lost_events_increase_30m` (recorder) | `sum by (node) (increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m]))` | the gate value: any non-zero → window incomplete |
|
||||||
| `hubble:ring_buffer_read_rate_15m` (recorder) | `sum by (node) (rate(hubble_lost_events_total{source="hubble_ring_buffer"}[15m]))` | read churn on the ring, events/s |
|
|
||||||
| `hubble:flows_processed_increase_30m` (recorder) | `sum by (node) (increase(hubble_flows_processed_total{type="Trace"}[30m]))` | denominator for the ratio |
|
| `hubble:flows_processed_increase_30m` (recorder) | `sum by (node) (increase(hubble_flows_processed_total{type="Trace"}[30m]))` | denominator for the ratio |
|
||||||
| `HubbleFlowWindowIncomplete` (warning) | `hubble:lost_events_increase_30m > 0` for 10 m | a flow-shaped detector may not call this window clean — real loss only |
|
| `HubbleFlowWindowIncomplete` (warning) | `hubble:lost_events_increase_30m > 0` for 10 m | a flow-shaped detector may not call this window clean |
|
||||||
| `HubbleRingBufferReadChurn` (warning) | `hubble:ring_buffer_read_rate_15m > 0.05` for 10 m | status-call storm / ring under a minute of flows; **reads, not drops** |
|
| `HubbleFlowLossMaterial` (critical) | `lost / processed > 0.001` for 15 m | loss that is material, not a boundary artefact |
|
||||||
| `HubbleFlowLossMaterial` (critical) | `sum by (node) (hubble:lost_events_increase_30m) / flows > 0.001` for 15 m | real loss that is material, not a boundary artefact |
|
|
||||||
| `HubbleFlowSensorMissing` (critical) | `absent(hubble:flows_processed_increase_30m)` for 15 m | no input at all; the gate cannot even be evaluated |
|
| `HubbleFlowSensorMissing` (critical) | `absent(hubble:flows_processed_increase_30m)` for 15 m | no input at all; the gate cannot even be evaluated |
|
||||||
|
|
||||||
All five live in `monitoring/controllers/home/hubble-loss-gate.yaml`
|
All four live in `monitoring/controllers/home/hubble-loss-gate.yaml`
|
||||||
(Flux → `monitoring` Kustomization), so they evaluate against the same
|
(Flux → `monitoring` Kustomization), so they evaluate against the same
|
||||||
Prometheus the detectors read and route to Alertmanager.
|
Prometheus the detectors read and route to Alertmanager.
|
||||||
|
|
||||||
|
|
@ -156,32 +147,7 @@ Prometheus the detectors read and route to Alertmanager.
|
||||||
over the *same* range; if `hubble:lost_events_increase_30m > 0` for the node(s)
|
over the *same* range; if `hubble:lost_events_increase_30m > 0` for the node(s)
|
||||||
in scope, the result is `incomplete` — never "no anomalous traffic". Alerting on
|
in scope, the result is `incomplete` — never "no anomalous traffic". Alerting on
|
||||||
silence (absence of an expected event) is the case that matters most: a lossy
|
silence (absence of an expected event) is the case that matters most: a lossy
|
||||||
window produces false silence, not false noise. `hubble_ring_buffer` alone is
|
window produces false silence, not false noise.
|
||||||
never grounds for `incomplete`: it is a read counter.
|
|
||||||
|
|
||||||
### Follow-up 2026-11-27: the gate as first written paged on reads
|
|
||||||
|
|
||||||
The first version of these rules recorded
|
|
||||||
`increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m])` and alerted
|
|
||||||
at `> 0`. That reproduced the artefact the deeper ring was meant to remove and
|
|
||||||
paged on it: measured at 18:39Z, `HubbleFlowWindowIncomplete` was firing on all
|
|
||||||
three nodes with `hubble:lost_events_increase_30m` ≈ 2.01, while
|
|
||||||
`perf_event_ring_buffer` and `observer_events_queue` were 0 everywhere and the
|
|
||||||
ring-buffer counter stepped +1 twice in an hour (18:27, 18:35 — identical
|
|
||||||
timestamps on all three nodes) with the Hubble UI open from the admin laptop. A
|
|
||||||
`for: 10m` cannot fix that: two status reads an hour keep `increase() > 0` true
|
|
||||||
for the whole hour, and the same recorder fed `HubbleFlowLossMaterial`, where a
|
|
||||||
couple of extra counts out of ~7 k flows on the quiet Pi node is 0.03 %.
|
|
||||||
|
|
||||||
Split applied: the gate recorder now covers `perf_event_ring_buffer` +
|
|
||||||
`observer_events_queue` only, `HubbleFlowWindowIncomplete` and
|
|
||||||
`HubbleFlowLossMaterial` read that (unchanged thresholds), and
|
|
||||||
`hubble_ring_buffer` gets rate-based `HubbleRingBufferReadChurn` at **0.05
|
|
||||||
events/s over 15 m** — ~45 reads per window, versus the F10 probe storm's
|
|
||||||
~0.2/s (12/min) and the current ~0.001/s (2 reads/hour). Both firing conditions
|
|
||||||
name the source in the summary so a read is never described as a dropped flow.
|
|
||||||
`hubble.eventBufferCapacity` was not touched and the agents were not rolled.
|
|
||||||
|
|
||||||
|
|
||||||
## Verification (live, 2026-11-27)
|
## Verification (live, 2026-11-27)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,6 @@ deploying another exporter.
|
||||||
`forgejo-runner-prune-*` CronJob pods, which are `Completed` and therefore
|
`forgejo-runner-prune-*` CronJob pods, which are `Completed` and therefore
|
||||||
permanently "not Ready" — that turned a not-Ready stat from 0 into 3 until the
|
permanently "not Ready" — that turned a not-Ready stat from 0 into 3 until the
|
||||||
selector was narrowed to the three Deployment pod prefixes.
|
selector was narrowed to the three Deployment pod prefixes.
|
||||||
- **Two namespaces on one board: runner pods live in `ci-runners`, the queue lives in the `forgejo` database.** The CI capsule moved to `ci-runners` (so `forgejo` can enforce PSA `baseline` — see `docs/pod-security.md`), so every pod/PVC/Deployment target is built from `build.py`'s single `CI_RUNNERS_NS = 'ci-runners'` constant. The `cnpg_actions_*` / `cnpg_*` targets keep `namespace="forgejo"`: that label comes from the scrape of the CNPG **database** cluster, not from the runners. Never blanket-replace the namespace in either direction — a runner-pod query against `forgejo` is silently empty, and a DB query against `ci-runners` is too. Moving the capsule again should be a one-line `CI_RUNNERS_NS` change plus a regenerate.
|
|
||||||
- **CNPG custom-query metrics carry `namespace`/`pod` from the scrape, not the
|
- **CNPG custom-query metrics carry `namespace`/`pod` from the scrape, not the
|
||||||
exporter's `cluster` label.** `cnpg_collector_*` has `cluster`; the
|
exporter's `cluster` label.** `cnpg_collector_*` has `cluster`; the
|
||||||
`cnpg_actions_*` and `cnpg_pg_stat_*` families do not. Filter those by
|
`cnpg_actions_*` and `cnpg_pg_stat_*` families do not. Filter those by
|
||||||
|
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
||||||
# Namespace network isolation
|
|
||||||
|
|
||||||
**State since 2026-11-27 (audit finding F3 / A5-1, card `t_fed52919`).** Before that the cluster
|
|
||||||
was one flat L2/L3 domain: a pod in any namespace could reach every other namespace's services, the
|
|
||||||
API server, the internal Gateway ports on `10.10.0.2` (`:8081` Grafana, `:8084` Hubble,
|
|
||||||
`:8085` Metabase, `:8086/:8087` customer1) and the internet.
|
|
||||||
|
|
||||||
## What is covered
|
|
||||||
|
|
||||||
Each app namespace carries two objects in `apps/base/<ns>/networkpolicy.yaml`,
|
|
||||||
applied by the `apps` Flux Kustomization:
|
|
||||||
|
|
||||||
| namespace | default-deny | allow policy | internet egress | Garage/S3 | CI/backup SSH | API |
|
|
||||||
|---|---|---|---|---|---|---|
|
|
||||||
| `customer1` | yes | `customer1-allow` | **no** (by design) | no | no | no |
|
|
||||||
| `osint` | yes | `osint-allow` | yes | no | no | no |
|
|
||||||
| `sirius-growth` | yes | `sirius-growth-allow` | yes | 3900 | 22 | yes |
|
|
||||||
| `piedmont` | yes | `piedmont-allow` | yes | no | no | no |
|
|
||||||
| `siriusdevops` | yes | `siriusdevops-allow` | yes | 3900 | no | no |
|
|
||||||
| `forgejo` | yes | `forgejo-allow` | yes | no | 22 | yes |
|
|
||||||
|
|
||||||
`customer1` also carries `quota.yaml`: a `ResourceQuota` + `LimitRange` sized from the declared
|
|
||||||
1-replica shape of the parked sandbox (2 CPU / 4Gi requests, 4 CPU / 10Gi limits, 45Gi storage,
|
|
||||||
`max` 1 CPU / 2Gi per container). See the comments in that file for the arithmetic.
|
|
||||||
|
|
||||||
`metabase`, `monitoring`, `logging`, `kube-system`, `ci-runners`, `netsec` and `secops` are **not**
|
|
||||||
isolated yet — they are the next tier (monitoring/logging legitimately reach everything).
|
|
||||||
|
|
||||||
## How the deny is expressed
|
|
||||||
|
|
||||||
* **Deny**: `networking.k8s.io/v1 NetworkPolicy` named `default-deny`,
|
|
||||||
`podSelector: {}`, `policyTypes: [Ingress, Egress]`, no rules. A stock NetworkPolicy is
|
|
||||||
unambiguous in Cilium's k8s-policy path, and unlike a `CiliumClusterwideNetworkPolicy` with
|
|
||||||
`endpointSelector: {}` it cannot silently select `kube-system`/CoreDNS/Flux.
|
|
||||||
* **Allow**: `CiliumNetworkPolicy` per namespace with `endpointSelector: {}`. Cilium *unions* all
|
|
||||||
policies that select an endpoint, so deny + allow = the effective policy. The Cilium CRD is needed
|
|
||||||
because the permitted sources/destinations are Cilium **entities**.
|
|
||||||
|
|
||||||
## The five rules every namespace needs
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
ingress:
|
|
||||||
- fromEntities: [ingress, host, remote-node, health] # Gateway proxy + kubelet + cilium-health
|
|
||||||
- fromEndpoints: # INTRA-NAMESPACE, see below
|
|
||||||
- matchLabels: {io.kubernetes.pod.namespace: <ns>}
|
|
||||||
egress:
|
|
||||||
- toEndpoints: kube-dns :53 (UDP+TCP)
|
|
||||||
- toEndpoints: own namespace
|
|
||||||
- toEntities: [world] # internet + LAN + VPN peers, NOT pods/nodes
|
|
||||||
```
|
|
||||||
|
|
||||||
Entities that matter here:
|
|
||||||
|
|
||||||
| entity | what it is | why it appears |
|
|
||||||
|---|---|---|
|
|
||||||
| `ingress` | Cilium Gateway/listener proxy | **measured**: `hubble observe --to-namespace forgejo --to-port 3000` shows the source identity as `reserved:ingress` (identity 8), not `host`. Traffic arrives via cloudflared → hostNetwork Envoy → pod. |
|
|
||||||
| `host` | the local node IP | kubelet probes and host-network datapath |
|
|
||||||
| `remote-node` | other nodes' IPs | cross-node gateway ingress; Garage (`10.10.0.1`, `10.10.0.5`) and the Linode SSH target live here, **not** in `world` |
|
|
||||||
| `kube-apiserver` | the apiserver identity | attached to the **whole node IP** `10.10.0.2` because apiserver is host-networked — always port-scope it (see below) |
|
|
||||||
| `health` | cilium-health | inter-node health probes |
|
|
||||||
|
|
||||||
## Gotchas that cost time (all measured 2026-11-27)
|
|
||||||
|
|
||||||
1. **Cilium enforces at both ends.** An egress rule alone does not let a pod reach its own
|
|
||||||
Service: the destination pod's ingress policy must allow it too. Symptom: a probe pod in the
|
|
||||||
namespace gets `TimeoutError` on `own-service.<ns>.svc:5432` while the public route works fine
|
|
||||||
(that one enters as `ingress`). Add the same-namespace `fromEndpoints` ingress rule as well.
|
|
||||||
Confirmed by re-running the probe after adding it: `OPEN`.
|
|
||||||
2. **`toEntities: [kube-apiserver]` without `toPorts` opens the whole gateway node.** The apiserver
|
|
||||||
is host-networked on `10.10.0.2`, and Cilium attaches the `kube-apiserver` identity to that IP,
|
|
||||||
so an unscoped rule also allowed `:8085`, `:8081`, `:9100`, `:10250`. Measured, then fixed with
|
|
||||||
`toPorts: [6443, 443]` (443 = the service port the CNPG instance manager / `kubectl` dial;
|
|
||||||
6443 = the backend port). Re-probe: `apiserver OPEN`, `:8085/:8081/:9100/:10250 CLOSED`.
|
|
||||||
3. **`ipBlock`/`toCIDR` is inert for node IPs.** `10.10.0.1` (Garage on the Pi) resolves to
|
|
||||||
`reserved:remote-node`, and CIDR rules are only evaluated for `reserved:world`. Use
|
|
||||||
`toEntities: [remote-node]` + `toPorts`.
|
|
||||||
4. **`world` is not "the internet".** It is everything outside the cluster: public IPs **and** the
|
|
||||||
LAN (`192.168.1.0/24`) and VPN peers. Cluster pods and node IPs are *not* in `world`, which is
|
|
||||||
what makes `toEntities: [world]` a safe "internet only" rule.
|
|
||||||
5. **A deny shows up as `TimeoutError`, an empty Service as `ConnectionRefusedError`.** Useful when
|
|
||||||
reading probes: `pg.customer1.svc:5432` refusing proves the policy *permits* the path and the
|
|
||||||
namespace is simply parked at 0 replicas.
|
|
||||||
|
|
||||||
## Adding a dependency
|
|
||||||
|
|
||||||
1. Add the rule to that namespace's allow policy — DNS, same-namespace and the entity list are
|
|
||||||
already there; most additions are one `toEntities`/`toPorts` block.
|
|
||||||
2. Prove it both ways: the new path must go `OPEN`, and `forgejo:3000`, `metabase:3000`,
|
|
||||||
`grafana:80`, `kubernetes.default:443` (where not needed) and `10.10.0.2:8085` must stay
|
|
||||||
`CLOSED` from that namespace.
|
|
||||||
3. Watch the deny side while you test: `hubble observe --verdict DROPPED -o compact` on the
|
|
||||||
namespace you changed (`policy-verdict:...DENIED` lines name the exact port).
|
|
||||||
4. Push through a PR; Flux owns the objects. A `kubectl apply` is only for testing and will be
|
|
||||||
adopted by the next reconcile.
|
|
||||||
|
|
@ -99,122 +99,11 @@ What was already removed from the runner shape (same change, card
|
||||||
|
|
||||||
Residual risk, stated plainly: a privileged dind container is node root on the
|
Residual risk, stated plainly: a privileged dind container is node root on the
|
||||||
node it runs on, and a CI job can reach that daemon socket by design. The
|
node it runs on, and a CI job can reach that daemon socket by design. The
|
||||||
capsule therefore means "trusted CI code" rather than isolation. The one
|
capsule therefore means "trusted CI code" rather than isolation. The remaining
|
||||||
hardening path that changes what `privileged: true` *means* is a virtualised
|
hardening path is a runtime that virtualises the container runtime (sysbox or
|
||||||
runtime behind a `RuntimeClass`; it was evaluated and staged on one runner —
|
gVisor) behind a `RuntimeClass`, which would allow `enforce: baseline` on the
|
||||||
see below.
|
capsule too; that is a separate design card because it changes how every job
|
||||||
|
container executes.
|
||||||
## `enforce: baseline` on `ci-runners` is unreachable by any runtime (measured)
|
|
||||||
|
|
||||||
All three candidate runtimes were installed on **both** arches and exercised
|
|
||||||
against the live cluster on 2026-11-27 (v1.36.4, containerd 2.3.4/2.3.5, Cilium
|
|
||||||
native routing). Architecture was never the blocker: sysbox-ce 0.7.2 ships an
|
|
||||||
arm64 `.deb`, gVisor publishes `gvisor-aarch64`, Kata publishes
|
|
||||||
`kata-static-4.4.0-arm64`, and `/dev/kvm` exists on siriussec **and** rpi.
|
|
||||||
|
|
||||||
The blocker is a contradiction, not a bug:
|
|
||||||
|
|
||||||
> PSA `baseline` forbids adding any capability outside `AUDIT_WRITE, CHOWN,
|
|
||||||
> DAC_OVERRIDE, FOWNER, FSETID, KILL, MKNOD, NET_BIND_SERVICE, SETFCAP, SETGID,
|
|
||||||
> SETPCAP, SETUID, SYS_CHROOT` — and every nested dockerd needs `SYS_ADMIN`
|
|
||||||
> (overlay, mounts) + `NET_ADMIN` (docker0, iptables) **in the pod spec**.
|
|
||||||
|
|
||||||
Measured verdicts, each on a live cluster:
|
|
||||||
|
|
||||||
| runtime | verdict |
|
|
||||||
|---|---|
|
|
||||||
| sysbox-ce 0.7.2 | The only one **admitted** at `enforce: baseline` with a clean spec (id-mapped userns, `uid_map 0 427680 65536`), but its inner dockerd cannot use the CNI-owned pod netns: `Failed to create bridge docker0 via netlink: operation not permitted`, `iptables ... Could not fetch rule set generation id: Permission denied`, and with `--bridge=none` every `docker run` dies on `failed to set into network namespace ... operation not permitted`. sysbox also bans inner `--net=host`, so there is no egress fallback. Also needs `enable_unprivileged_ports=false` + `enable_unprivileged_icmp=false` under containerd 2.x. |
|
|
||||||
| gVisor | Full CI shape works (nested run, pull, build, overlay2) **only** with `capabilities.add: ["ALL"]`; with a baseline-clean spec dockerd never starts (`failed to mount overlay: operation not permitted`). |
|
|
||||||
| Kata 4.4.0 | `privileged: false` hits the same caps wall *inside the guest*. With `privileged: true` the whole CI shape works on amd64 **and** arm64 (nested run, bridge+NAT egress, `docker build`) — but `/var/lib/docker` is virtiofs, overlayfs refuses it, and Docker falls back to `vfs`. |
|
|
||||||
|
|
||||||
So the letter of the original audit finding (drop `privileged`, enforce
|
|
||||||
`baseline`) cannot be met by swapping a runtime; only reworking CI off
|
|
||||||
docker-in-docker could, and that rewrites every workflow. The operator's
|
|
||||||
decision (card `t_8aa4af50`) was to take the one option that changes the
|
|
||||||
*consequence* of the flag, staged to a single runner.
|
|
||||||
|
|
||||||
## Kata microVM on the deploy runner (`forgejo-runner-deploy-arm64`, staged)
|
|
||||||
|
|
||||||
`forgejo-runner-deploy-arm64` (rpi) now runs with
|
|
||||||
`runtimeClassName: kata-qemu`. **Read this precisely:**
|
|
||||||
|
|
||||||
* the pod **still declares `privileged: true`** and `ci-runners` **still
|
|
||||||
enforces `privileged`**. Nothing about this namespace's PSA level changed; a
|
|
||||||
privileged pod in `forgejo` is still rejected;
|
|
||||||
* what changed is the blast radius: the dind sidecar and the job containers
|
|
||||||
live in a QEMU/KVM microVM with no host namespaces, no host kernel and only
|
|
||||||
the volumes the pod mounts. An escape from CI has to beat KVM, not just the
|
|
||||||
container runtime. On a runc runner the same flag is direct root on rpi;
|
|
||||||
* `forgejo-runner-amd64` and `forgejo-runner-arm64` are untouched (still
|
|
||||||
privileged dind under runc), so `docker-amd64` and `runs-on: docker` are
|
|
||||||
unchanged. Converting them is a separate decision, taken on the measured cost
|
|
||||||
of this one.
|
|
||||||
|
|
||||||
How it is wired (all in `apps/base/forgejo/`):
|
|
||||||
|
|
||||||
* `kata-runtimeclass.yaml` — `RuntimeClass` `kata-qemu`, handler `kata-qemu`;
|
|
||||||
* rpi's containerd has the handler via the drop-in
|
|
||||||
`/etc/containerd/conf.d/50-kata.toml` (`io.containerd.kata.v2`,
|
|
||||||
`privileged_without_host_devices = true` — a privileged container otherwise
|
|
||||||
receives all 218 of the node's `/dev` nodes, which is meaningless inside a VM
|
|
||||||
and makes runtime-rs fail the create with `get host path failed`), with
|
|
||||||
kata-static 4.4.0 under `/opt/kata` and
|
|
||||||
`/etc/kata-containers/configuration.toml` symlinked to the runtime-rs QEMU
|
|
||||||
config;
|
|
||||||
* the dind sidecar builds its own ext4 data-root: a 16 GiB image file at
|
|
||||||
`/data-docker/kata-ext4.img` on the existing claim, attached with
|
|
||||||
`losetup /dev/loop0` (the guest has to `mknod` the node — only
|
|
||||||
`/dev/loop-control` exists) and mounted at `/var/lib/docker`. This is what
|
|
||||||
restores `overlay2`; without it Docker silently uses `vfs`;
|
|
||||||
* the guest kernel has **no** binfmt registrations (the host's are not visible
|
|
||||||
from inside the VM), so every start mounts `binfmt_misc` and runs
|
|
||||||
`tonistiigi/binfmt --install amd64`. Without that, `deploy-site.yml`'s
|
|
||||||
`docker buildx build --platform linux/amd64` dies with `exec format error` /
|
|
||||||
`buildkit-qemu-x86_64: executable file not found`;
|
|
||||||
* the runner container waits for `/var/run/dind-ready`, which the dind sidecar
|
|
||||||
touches **after** the data-root and binfmt are set up, so a job can never
|
|
||||||
start against a half-initialised daemon.
|
|
||||||
|
|
||||||
Rollback is one field: drop `runtimeClassName: kata-qemu` from that Deployment
|
|
||||||
(Flux) — the pod returns to runc/privileged dind on the same claim, and the
|
|
||||||
`kata-ext4.img` is an unused file until then (it is a cache; deleting it is
|
|
||||||
safe). The containerd drop-in on rpi is inert once no pod asks for the handler.
|
|
||||||
|
|
||||||
### Measured cost of the microVM (warm cache, same content)
|
|
||||||
|
|
||||||
| workflow | runner / runtime | run | wall clock |
|
|
||||||
|---|---|---|---|
|
|
||||||
| `deploy-site` (sirius-growth) | `deploy-arm64`, runc | 130 | 22 s |
|
|
||||||
| `deploy-site` (sirius-growth) | `deploy-arm64`, runc | 129 | 31 s |
|
|
||||||
| `deploy-site` (sirius-growth) | `deploy-arm64`, **Kata** | 133 | **48 s** |
|
|
||||||
| `deploy` (siriusdevops) | `docker-amd64`, runc (untouched) | 67 | 49 s (66: 49 s) |
|
|
||||||
|
|
||||||
So the VM costs roughly **+25 s per deploy** on a warm image cache (boot + guest
|
|
||||||
plumbing), and pushes the amd64 site image with its own digest
|
|
||||||
(`sirius-growth-site:7e1dd4cc…`, manifest `sha256:7b2987b4…`). The untouched
|
|
||||||
amd64 runner is unchanged to the second, and `runs-on: docker` was not touched.
|
|
||||||
|
|
||||||
Three things had to be fixed before the first real job would run — all measured,
|
|
||||||
all in the manifests now:
|
|
||||||
|
|
||||||
1. **The dind socket must not live on virtiofs.** A disk-backed `emptyDir` is a
|
|
||||||
virtiofs share; a unix socket created there is *visible* but unconnectable
|
|
||||||
from the other containers (`runner: cannot ping the docker daemon …` while
|
|
||||||
`dind: docker version` on the same path succeeds). The socket directory is
|
|
||||||
`medium: Memory` (tmpfs in the guest) instead.
|
|
||||||
2. **No per-job `--memory` inside the VM.** The guest cgroup root is
|
|
||||||
`domain threaded` with only `cpuset cpu pids` delegated, so dockerd cannot
|
|
||||||
apply a memory limit and every job dies at `docker run` with
|
|
||||||
`cannot enter cgroupv2 "/sys/fs/cgroup/docker" with domain controllers`.
|
|
||||||
The 2Gi dind limit sizes the VM, so that is the bound now.
|
|
||||||
3. **binfmt is per-VM.** The host's qemu handlers are not visible inside the
|
|
||||||
guest, so `--platform linux/amd64` needs `tonistiigi/binfmt --install amd64`
|
|
||||||
on every pod start (the image itself is cached in the ext4 data-root).
|
|
||||||
|
|
||||||
Operational note: the Deployment is `strategy: Recreate`, so a rollout during a
|
|
||||||
run kills the job *and* leaves the Forgejo run `running` forever (reproduced,
|
|
||||||
run 132 — there is no cancel endpoint). Land template changes while the runner
|
|
||||||
is idle.
|
|
||||||
|
|
||||||
## Why the dind sidecar keeps `privileged` (measured, do not re-derive)
|
## Why the dind sidecar keeps `privileged` (measured, do not re-derive)
|
||||||
|
|
||||||
|
|
@ -255,8 +144,4 @@ kubectl -n forgejo run probe-bad --image=busybox --restart=Never \
|
||||||
|
|
||||||
# the prune CronJob (and its RBAC) now live in the capsule
|
# the prune CronJob (and its RBAC) now live in the capsule
|
||||||
kubectl -n ci-runners get cronjob,role,rolebinding,sa -l app=forgejo-runner
|
kubectl -n ci-runners get cronjob,role,rolebinding,sa -l app=forgejo-runner
|
||||||
|
|
||||||
# only the deploy runner is a microVM; the other two are runc/privileged dind
|
|
||||||
kubectl -n ci-runners get pods -l app=forgejo-runner \
|
|
||||||
-o custom-columns=NAME:.metadata.name,RUNTIME:.spec.runtimeClassName,NODE:.spec.nodeName
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
# Registry pull authentication (Forgejo container registry)
|
# Registry pull authentication (Forgejo container registry)
|
||||||
|
|
||||||
Status: **enforced** since 2026-11-27 (audit finding F11), re-implemented at the edge on
|
Status: **enforced** since 2026-11-27 (audit finding F11). Every workload that pulls
|
||||||
2026-12-02 so public repos can be browsed anonymously again. Every workload that pulls
|
|
||||||
`forgejo.siriusdevops.com/sirius/*` carries `imagePullSecrets: [forgejo-pull]`, and the
|
`forgejo.siriusdevops.com/sirius/*` carries `imagePullSecrets: [forgejo-pull]`, and the
|
||||||
registry refuses to mint tokens for anonymous clients — now via a Cloudflare WAF rule rather
|
registry refuses to mint tokens for anonymous clients.
|
||||||
than `REQUIRE_SIGNIN_VIEW`.
|
|
||||||
|
|
||||||
## What was wrong
|
## What was wrong
|
||||||
|
|
||||||
|
|
@ -24,39 +22,25 @@ with `{"UserID": -1, "Scope": ""}` and that token returned `200` for
|
||||||
|
|
||||||
## The switch
|
## The switch
|
||||||
|
|
||||||
`apps/base/forgejo/deployment.yaml` now runs with public browsing **on**:
|
`apps/base/forgejo/deployment.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: FORGEJO__service__REQUIRE_SIGNIN_VIEW
|
- name: FORGEJO__service__REQUIRE_SIGNIN_VIEW
|
||||||
value: "false"
|
value: "true"
|
||||||
```
|
|
||||||
|
|
||||||
and the registry guard moved to the edge — Cloudflare zone `siriusdevops.com`, phase
|
|
||||||
`http_request_firewall_custom`, rule **"Block anonymous Forgejo registry tokens"**:
|
|
||||||
|
|
||||||
```
|
|
||||||
(http.host eq "forgejo.siriusdevops.com") and (starts_with(http.request.uri.path, "/v2/token"))
|
|
||||||
and (not any(http.request.headers["authorization"][*] contains "Basic"))
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Effects:
|
Effects:
|
||||||
|
|
||||||
* Anonymous `/v2/token` → `403` from Cloudflare (never reaches Forgejo, so no ghost token is
|
* `/v2/token` → `401 {"errors":[{"code":"UNAUTHORIZED",...}]}` for an anonymous client, and
|
||||||
minted). `/v2/` still answers the normal `401` challenge, so registry clients keep their
|
`/v2/<repo>/manifests/<ref>` → `401` with a `WWW-Authenticate` challenge.
|
||||||
auth flow.
|
|
||||||
* Authenticated callers (basic auth: username + access token) still get the two-stage flow:
|
* Authenticated callers (basic auth: username + access token) still get the two-stage flow:
|
||||||
`/v2/token` (returns a scoped JWT) → `Bearer <jwt>` on `/v2/...`. Verified 2026-12-02 with
|
`/v2/token` (returns a scoped JWT) → `Bearer <jwt>` on `/v2/...`.
|
||||||
the `registry-reader` credential: token minted, `manifests/<ref>` → `200`.
|
* The **web UI and the REST API are login-only for anonymous visitors**. Public repos
|
||||||
* Public repos (`homek8s`, `onionwire`, `osint-dashboard`, `gcloud-lab`, `netsec-agent`, …) are
|
(`homek8s`, `onionwire`, `osint-dashboard`, …) are no longer browsable or clonable without a
|
||||||
browsable and clonable anonymously again; private repos still 404 for anonymous visitors.
|
Forgejo account. This is deliberate: the instance is a dev/infra host, not a public code
|
||||||
* Package **metadata** (`/api/v1/packages/...` listing, tags) is still readable anonymously —
|
forge; the public *sites* are served from the cluster, not from Forgejo.
|
||||||
only token minting is blocked, so blobs stay protected.
|
|
||||||
* CI pushes are unaffected — workflows authenticate with `REGISTRY_TOKEN` (`write:package`).
|
* CI pushes are unaffected — workflows authenticate with `REGISTRY_TOKEN` (`write:package`).
|
||||||
|
|
||||||
**Order matters when changing this:** the WAF rule must be live *before* (or at the same time
|
|
||||||
as) setting `REQUIRE_SIGNIN_VIEW=false`. Flipping the env var alone re-opens anonymous pulls of
|
|
||||||
every image, including those of private repos.
|
|
||||||
|
|
||||||
## The credential
|
## The credential
|
||||||
|
|
||||||
A dedicated non-admin user, `registry-reader` (visibility `limited`, `read:package` scope).
|
A dedicated non-admin user, `registry-reader` (visibility `limited`, `read:package` scope).
|
||||||
|
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
# Backup tooling image for the three nightly state-backup CronJobs
|
|
||||||
# (monitoring/grafana-backup, forgejo/cluster-backup, sirius-growth/leadgen-backup).
|
|
||||||
#
|
|
||||||
# Why this exists (card t_9d0428d8): every one of those jobs used to run
|
|
||||||
# `apk add --no-cache rsync openssh-client` at container start, which dialled
|
|
||||||
# dl-cdn.alpinelinux.org (Fastly anycast 151.101.x.132:443) on every run. That
|
|
||||||
# made the nightly backup depend on the public internet, tripped the
|
|
||||||
# `egress-new-dst` flow alert whenever Fastly rotated an address, and put a
|
|
||||||
# package install on the one pod that carries the Grafana PVC and an SSH key.
|
|
||||||
# The toolchain is baked in at build time instead, and the pods get an egress
|
|
||||||
# NetworkPolicy that admits DNS + the backup host only.
|
|
||||||
#
|
|
||||||
# Base image is pinned by digest (multi-arch index digest; this build is
|
|
||||||
# linux/amd64 because all three jobs are nodeSelector'd to siriussec).
|
|
||||||
FROM python:3.12-alpine@sha256:c5ba3deef00c7758561a0f03c26f44f10589263d40e732b8748e0d1f38f6dd89
|
|
||||||
|
|
||||||
# kubectl is needed by forgejo/cluster-backup only (CNPG `get cluster` +
|
|
||||||
# `exec` pg_dump); the cluster runs v1.36.4, so the client is pinned to the
|
|
||||||
# same minor and its release checksum is verified at build time.
|
|
||||||
ARG KUBECTL_VERSION=v1.36.4
|
|
||||||
ARG KUBECTL_SHA256=8b8f088da2dab964f853b38464033b1be15ede2839eca751482357c45abdd05a
|
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="backup-tools" \
|
|
||||||
org.opencontainers.image.description="python3.12-alpine + rsync + openssh-client + bash + kubectl for the nightly state backups" \
|
|
||||||
org.opencontainers.image.source="https://forgejo.siriusdevops.com/sirius/homek8s"
|
|
||||||
|
|
||||||
RUN set -eux; \
|
|
||||||
# bash: cluster-backup and leadgen-backup use arrays, `set -o pipefail`
|
|
||||||
# and `tee >(...)` process substitution, so /bin/sh (busybox ash) is not
|
|
||||||
# enough -- the CronJob entrypoints stay /bin/bash, unchanged.
|
|
||||||
apk add --no-cache rsync openssh-client bash; \
|
|
||||||
test "${TARGETARCH:-amd64}" = "amd64" || { echo "kubectl pin is amd64-only; the backup jobs run on siriussec" >&2; exit 1; }; \
|
|
||||||
apk add --no-cache --virtual .fetch curl ca-certificates; \
|
|
||||||
curl -fsSL -o /usr/local/bin/kubectl \
|
|
||||||
"https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"; \
|
|
||||||
echo "${KUBECTL_SHA256} /usr/local/bin/kubectl" | sha256sum -c -; \
|
|
||||||
chmod 0755 /usr/local/bin/kubectl; \
|
|
||||||
apk del .fetch; \
|
|
||||||
rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
# Build-time proof that nothing has to be installed at run time.
|
|
||||||
RUN set -eux; \
|
|
||||||
rsync --version | head -1; \
|
|
||||||
ssh -V; \
|
|
||||||
bash --version | head -1; \
|
|
||||||
python3 --version; \
|
|
||||||
kubectl version --client
|
|
||||||
|
|
||||||
CMD ["/bin/sh"]
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
# Envoy access logging for every Gateway served by the Cilium GatewayClass.
|
|
||||||
#
|
|
||||||
# Finding F7 (2026-11-27 netsec audit): cilium-envoy emitted no request-level
|
|
||||||
# record at all, so the design's HTTP attack-shape rules (§4d: traversal,
|
|
||||||
# `union select`, `%00`, .env/.git probes, high-rate 401/403 per client,
|
|
||||||
# scanner user-agents) had no input stream.
|
|
||||||
#
|
|
||||||
# Cilium 1.20 renders this into the Gateway listeners' HTTP connection manager
|
|
||||||
# and writes one JSON line per request to the cilium-envoy container's stdout,
|
|
||||||
# i.e. /var/log/pods/kube-system_cilium-envoy-*/cilium-envoy/*.log, which the
|
|
||||||
# node log store (Alloy -> Loki) already tails.
|
|
||||||
#
|
|
||||||
# Deliberately NOT logged:
|
|
||||||
# * no debug/trace Envoy application logging (disk is the constraint here);
|
|
||||||
# * no request/response headers wholesale and no bodies -- Authorization,
|
|
||||||
# Cookie and Set-Cookie therefore never reach disk. Only the named fields
|
|
||||||
# below are emitted, each an explicit command operator.
|
|
||||||
#
|
|
||||||
# `client_ip` is the real client identity: Envoy is hostNetwork, so the raw
|
|
||||||
# peer is cloudflared on the Pi (10.10.0.1). Cloudflare sets CF-Connecting-IP
|
|
||||||
# and cloudflared forwards it; `peer` and `x_forwarded_for` are kept so a
|
|
||||||
# missing/forged CF-Connecting-IP is visible rather than silently trusted.
|
|
||||||
apiVersion: cilium.io/v2alpha1
|
|
||||||
kind: CiliumGatewayClassConfig
|
|
||||||
metadata:
|
|
||||||
name: cilium
|
|
||||||
namespace: kube-system
|
|
||||||
spec:
|
|
||||||
description: Cilium GatewayClass with HTTP access logging (netsec F7)
|
|
||||||
telemetry:
|
|
||||||
accessLogs:
|
|
||||||
- format: JSON
|
|
||||||
targets:
|
|
||||||
- HTTP
|
|
||||||
json:
|
|
||||||
gateway: "%CILIUM_GATEWAY_NAMESPACE%/%CILIUM_GATEWAY_NAME%"
|
|
||||||
start_time: "%START_TIME%"
|
|
||||||
method: "%REQUEST_HEADER(:METHOD)%"
|
|
||||||
path: "%REQUEST_HEADER(X-ENVOY-ORIGINAL-PATH?:PATH)%"
|
|
||||||
protocol: "%PROTOCOL%"
|
|
||||||
response_code: "%RESPONSE_CODE%"
|
|
||||||
response_flags: "%RESPONSE_FLAGS%"
|
|
||||||
duration_ms: "%DURATION%"
|
|
||||||
bytes_received: "%BYTES_RECEIVED%"
|
|
||||||
bytes_sent: "%BYTES_SENT%"
|
|
||||||
authority: "%REQUEST_HEADER(:AUTHORITY)%"
|
|
||||||
client_ip: "%REQUEST_HEADER(CF-CONNECTING-IP)%"
|
|
||||||
x_forwarded_for: "%REQUEST_HEADER(X-FORWARDED-FOR)%"
|
|
||||||
peer: "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%"
|
|
||||||
user_agent: "%REQUEST_HEADER(USER-AGENT)%"
|
|
||||||
cf_ray: "%REQUEST_HEADER(CF-RAY)%"
|
|
||||||
upstream_host: "%UPSTREAM_HOST%"
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
# The Cilium GatewayClass, declared here so the access-log configuration is
|
|
||||||
# bound by GitOps rather than a hand patch.
|
|
||||||
#
|
|
||||||
# Why this file exists at all: the cilium Helm chart creates the GatewayClass
|
|
||||||
# (controllerName io.cilium/gateway-controller) but has no values knob for
|
|
||||||
# `spec.parametersRef`, and Cilium only reads `spec.telemetry.accessLogs` from
|
|
||||||
# the CiliumGatewayClassConfig referenced there. Owning the object here keeps
|
|
||||||
# the binding in sirius/homek8s and applied by Flux.
|
|
||||||
#
|
|
||||||
# The rendered spec is byte-for-byte the chart's GatewayClass plus parametersRef,
|
|
||||||
# so a Helm upgrade and this manifest agree on every other field.
|
|
||||||
apiVersion: gateway.networking.k8s.io/v1
|
|
||||||
kind: GatewayClass
|
|
||||||
metadata:
|
|
||||||
name: cilium
|
|
||||||
spec:
|
|
||||||
controllerName: io.cilium/gateway-controller
|
|
||||||
description: The default Cilium GatewayClass
|
|
||||||
parametersRef:
|
|
||||||
group: cilium.io
|
|
||||||
kind: CiliumGatewayClassConfig
|
|
||||||
name: cilium
|
|
||||||
namespace: kube-system
|
|
||||||
|
|
@ -3,5 +3,3 @@ kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- gateway.yaml
|
- gateway.yaml
|
||||||
- gatewayclass.yaml
|
|
||||||
- gatewayclass-config.yaml
|
|
||||||
|
|
|
||||||
|
|
@ -1,183 +0,0 @@
|
||||||
# Rosenpass monitoring (host exporters for Link A and Link B)
|
|
||||||
|
|
||||||
Rosenpass rotates the WireGuard preshared key on **Link A** (`rpi` wg0
|
|
||||||
`10.10.0.1` ↔ `siriussec` wg0 `10.10.0.2`) and on **Link B** (`rpi` wg-remote
|
|
||||||
`10.20.0.2` ↔ `linode` wg0 `10.20.0.1`) about every two minutes. WireGuard
|
|
||||||
keeps using the last PSK it was given, so if the exchange dies the tunnel stays
|
|
||||||
**up** and silently stops being post-quantum. These files make that state
|
|
||||||
visible in Prometheus.
|
|
||||||
|
|
||||||
They are host configuration, not cluster manifests — nothing here is reconciled
|
|
||||||
by Flux. The cluster side is `monitoring/controllers/home/rosenpass.yaml`
|
|
||||||
(PrometheusRule) plus the `prometheus-node-exporter` block in
|
|
||||||
`monitoring/controllers/home/values.yaml`, which enables the textfile
|
|
||||||
collector.
|
|
||||||
|
|
||||||
## Why a host script instead of a collector
|
|
||||||
|
|
||||||
`kube-prometheus-stack-prometheus-node-exporter` is distroless and ships
|
|
||||||
without `--collector.textfile.directory`; `--collector.systemd` would need dbus
|
|
||||||
plumbing the DaemonSet does not have. So one POSIX `sh` script writes a
|
|
||||||
textfile that node-exporter serves from `/metrics`.
|
|
||||||
|
|
||||||
## Install (rpi and siriussec only — never linode)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
install -m 0755 rosenpass-metrics.sh /usr/local/sbin/rosenpass-metrics.sh
|
|
||||||
install -m 0644 rosenpass-metrics.service /etc/systemd/system/
|
|
||||||
install -m 0644 rosenpass-metrics.timer /etc/systemd/system/
|
|
||||||
# Shared with the node-exporter DaemonSet's hostPath. The unit's sandbox sets
|
|
||||||
# ProtectSystem=strict, so this must exist before the first run (the kubelet's
|
|
||||||
# DirectoryOrCreate would normally make it once node-exporter rolls out).
|
|
||||||
install -d -m 0755 /var/lib/node-exporter/textfile
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable --now rosenpass-metrics.timer
|
|
||||||
systemctl start rosenpass-metrics.service # first sample now, not in 60 s
|
|
||||||
```
|
|
||||||
|
|
||||||
Requires `wg`, `sha256sum`, `systemctl` and `awk` — present on Debian (rpi) and
|
|
||||||
Arch (siriussec).
|
|
||||||
|
|
||||||
## Series
|
|
||||||
|
|
||||||
```
|
|
||||||
rosenpass_unit_active{node="rpi|siriussec"} 0|1
|
|
||||||
rosenpass_psk_rotation_age_seconds{node=...,interface="wg0|wg-remote"}
|
|
||||||
rosenpass_psk_rotation_last_change_timestamp_seconds{node=...,interface="wg0|wg-remote"}
|
|
||||||
rosenpass_upnp_mapping_present{node="rpi"} 0|1
|
|
||||||
rosenpass_upnp_last_check_timestamp_seconds{node="rpi"}
|
|
||||||
```
|
|
||||||
|
|
||||||
One series set per interface: `wg0` is Link A and `wg-remote` is Link B, and an
|
|
||||||
interface absent on that host (wg-remote on siriussec, where it does not exist)
|
|
||||||
is skipped. `RosenpassPskRotationStalled` is interface-agnostic
|
|
||||||
(`max by (node, interface) ... > 900`), so a stalled Link B pages as soon as the
|
|
||||||
`wg-remote` series exists — which is why hashing only `wg0` left Link B
|
|
||||||
unobserved. Its `absent()` arms name `rpi/wg0`, `rpi/wg-remote` and
|
|
||||||
`siriussec/wg0`, so a vanished Link B series pages too while siriussec never
|
|
||||||
claims a `wg-remote` it does not have.
|
|
||||||
|
|
||||||
`rosenpass_upnp_mapping_present` is the state `rosenpass-upnp.sh` stamped on its
|
|
||||||
last 15-minute run (`/run/rosenpass-upnp.present`, `1`/`0`), and
|
|
||||||
`rosenpass_upnp_last_check_timestamp_seconds` is that file's mtime — so a
|
|
||||||
stopped timer reads as stale rather than as a flat healthy `1`. The 60-second
|
|
||||||
metrics timer only reads the file; it never calls `upnpc`, which would poll the
|
|
||||||
router's IGD 1440 times a day. Where the state file does not exist (siriussec)
|
|
||||||
neither series is emitted.
|
|
||||||
|
|
||||||
The script hashes the output of `wg show <interface> preshared-keys` and stores
|
|
||||||
only the SHA-256 digest plus the last-change timestamp in
|
|
||||||
`/var/lib/rosenpass-exporter/last-hash-<interface>` (root-only, one file per
|
|
||||||
interface so a Link B rotation is never recorded as a Link A one). When the
|
|
||||||
digest changes the timestamp advances; otherwise only the age metric grows.
|
|
||||||
**Key material is never printed, logged or persisted.** The timer's own journal
|
|
||||||
therefore carries no key bytes — do not "improve" the script by echoing the
|
|
||||||
listing.
|
|
||||||
|
|
||||||
An interface unreadable (down, no `CAP_NET_ADMIN`) emits no series for that
|
|
||||||
interface rather than resetting its age; `rosenpass_unit_active` and the
|
|
||||||
`absent()` arms of the alerts cover that case, so a broken exporter still pages.
|
|
||||||
|
|
||||||
## Verify
|
|
||||||
|
|
||||||
```sh
|
|
||||||
systemctl list-timers rosenpass-metrics.timer
|
|
||||||
cat /var/lib/node-exporter/textfile/rosenpass.prom
|
|
||||||
```
|
|
||||||
|
|
||||||
Both metrics should be present and the age well under 300 s once the cluster
|
|
||||||
scrapes the file (the file exists on the host either way; Prometheus only sees
|
|
||||||
it after the `values.yaml` change is reconciled).
|
|
||||||
|
|
||||||
## Alerts
|
|
||||||
|
|
||||||
`RosenpassDown` (unit inactive for 5 m) and `RosenpassPskRotationStalled`
|
|
||||||
(age > 900 s for 10 m), both `severity: warning`, both with `absent()` guards
|
|
||||||
so a missing series alerts instead of reading as healthy. Both cover **Link A
|
|
||||||
and Link B**: the rotation rule keys on `(node, interface)`, and its `absent()`
|
|
||||||
arms name `rpi/wg0`, `rpi/wg-remote` and `siriussec/wg0`.
|
|
||||||
|
|
||||||
A third rule, `RosenpassUpnpMappingLost` (`severity: warning`, 10 m), covers
|
|
||||||
Link B's single inbound path: it fires when
|
|
||||||
`rosenpass_upnp_mapping_present == 0`, when no `rosenpass-upnp` run has stamped
|
|
||||||
the state for over 30 minutes (stopped timer, hung IGD), or when the series is
|
|
||||||
absent altogether.
|
|
||||||
|
|
||||||
## Link B (rpi wg-remote ↔ linode wg0)
|
|
||||||
|
|
||||||
Link B is the second transport link: rpi `wg-remote` `10.20.0.2` ↔ linode `wg0`
|
|
||||||
`10.20.0.1`, the exchange on UDP 9999 across the public internet. Two facts make
|
|
||||||
it fragile in ways Link A is not:
|
|
||||||
|
|
||||||
- **The Pi's inbound path is a UPnP mapping**, because the home router has no
|
|
||||||
accessible admin panel. `rosenpass-upnp.sh` re-asserts
|
|
||||||
`UDP 9999 -> 192.168.1.125:9999 'rosenpass-pq'` with a permanent lease every
|
|
||||||
15 minutes, logs to `logger -t rosenpass-upnp` and exits non-zero when the
|
|
||||||
mapping cannot be restored. Install:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
install -m 0755 rosenpass-upnp.sh /usr/local/sbin/
|
|
||||||
install -m 0644 rosenpass-upnp.service rosenpass-upnp.timer /etc/systemd/system/
|
|
||||||
systemctl daemon-reload && systemctl enable --now rosenpass-upnp.timer
|
|
||||||
upnpc -l | grep 9999 # 9999->192.168.1.125:9999, lease 0
|
|
||||||
```
|
|
||||||
|
|
||||||
- **The linode's peer block needs the Pi's public address, which is residential
|
|
||||||
DHCP.** Chosen strategy: a **documented static endpoint, no sync timer** —
|
|
||||||
proved from the router itself: `upnpc -s` reports the WAN connection
|
|
||||||
`Connected, uptime=…` with `Time started : Thu Sep 10 16:38:13 2026` and
|
|
||||||
`ExternalIPAddress = 137.118.156.124`, i.e. ~83 days on the address that is
|
|
||||||
configured, and three independent echo services agreed (2026-12-03). If the
|
|
||||||
address moves the exchange stops and the link keeps its last PSK — which is
|
|
||||||
what `rosenpass_psk_rotation_age_seconds{interface="wg-remote"}` catches.
|
|
||||||
Re-point by editing `endpoint = "<new-ip>:9999"` in the linode's
|
|
||||||
`/etc/rosenpass/config.toml` and `systemctl restart rosenpass` there (both
|
|
||||||
ends do not need restarting; the Pi dials `50.116.38.217:9999`).
|
|
||||||
|
|
||||||
Rollout order that cannot strand the far end: this link carries the only SSH path
|
|
||||||
to the linode, so `/root/rosenpass-linkb-rollback.sh`
|
|
||||||
(`linkb-rollback-rpi.sh`, `linkb-rollback-linode.sh`) is staged on **both** hosts
|
|
||||||
and armed as a transient `systemd-run --on-active=420s` timer *before* the
|
|
||||||
linode's unit starts, self-cancelling via `/run/rosenpass-linkb-ok`. It restores
|
|
||||||
the Pi's Link A-only `/etc/rosenpass/config.toml.pre-linkb` and the static
|
|
||||||
`PresharedKey`s from the untouched `/etc/wireguard/*.conf` with `wg syncconf`.
|
|
||||||
The Linode end is restored by `wg syncconf wg0` from its own conf, so the hub's
|
|
||||||
client peers keep working.
|
|
||||||
|
|
||||||
Verify both ends agree and the key rotates, without printing key material (run
|
|
||||||
as root on the Pi): `linkb-verify.sh` — it hashes each end's PSK, compares them,
|
|
||||||
and prints the Link A sentinel so a scoped rotation is distinguishable from an
|
|
||||||
interface-wide one. Expect a changed digest 180 s apart with `agree` on both
|
|
||||||
samples.
|
|
||||||
|
|
||||||
## Testing the rules without merging
|
|
||||||
|
|
||||||
`kustomize build monitoring/controllers/home` proves the rule renders; these two
|
|
||||||
prove the PromQL, before Flux ever sees it (a rule that loads but selects
|
|
||||||
nothing is the failure mode that matters here):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# 1. syntax + expression validation. promtool wants a bare `groups:` file, so
|
|
||||||
# strip the CRD wrapper first (PyYAML; jq cannot read YAML).
|
|
||||||
python3 - <<'PY'
|
|
||||||
import yaml
|
|
||||||
d = yaml.safe_load(open('monitoring/controllers/home/rosenpass.yaml'))
|
|
||||||
yaml.safe_dump({'groups': d['spec']['groups']}, open('/tmp/rosenpass-rules.yaml', 'w'))
|
|
||||||
PY
|
|
||||||
kubectl -n monitoring run promtool-check --rm -i --restart=Never \
|
|
||||||
--image=quay.io/prometheus/prometheus:v3.15.1-distroless \
|
|
||||||
--command -- /bin/promtool check rules /dev/stdin < /tmp/rosenpass-rules.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# 2. behaviour: promtool test rules with input_series. Mount the rule file and
|
|
||||||
# a test file (rule_files: [rosenpass-rules.yaml]) from a ConfigMap and check
|
|
||||||
# four scenarios — healthy (no alerts), one unit down (only that node), age
|
|
||||||
# over threshold plus a missing peer series, and every series missing (both
|
|
||||||
# absent() arms). Expect `SUCCESS`. Note promtool compares annotations
|
|
||||||
# exactly, so expectations have to carry the rendered text.
|
|
||||||
```
|
|
||||||
|
|
||||||
Keep the test file out of the repo: it duplicates the annotation strings, so any
|
|
||||||
edit to the alerts would have to re-derive it from `rosenpass.yaml`.
|
|
||||||
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Self-cancelling rollback for the Link B rollout, Linode end (wg0 hub).
|
|
||||||
#
|
|
||||||
# Armed as a transient `systemd-run --on-active=420s` timer on the Linode before
|
|
||||||
# rosenpass is started there. It acts locally, because the only SSH path to this
|
|
||||||
# host runs over the tunnel a PSK mismatch would break.
|
|
||||||
#
|
|
||||||
# Cancelled by touching /run/rosenpass-linkb-ok on this host once rotation and
|
|
||||||
# the cluster are verified.
|
|
||||||
#
|
|
||||||
# What it restores: the static PresharedKeys of every peer in
|
|
||||||
# /etc/wireguard/wg0.conf, and stops/disables the rosenpass unit. It never
|
|
||||||
# brings the interface down.
|
|
||||||
set -u
|
|
||||||
|
|
||||||
log() { logger -t rosenpass-linkb "$*"; echo "$*"; }
|
|
||||||
|
|
||||||
# Self-cancel: the operator touches this flag after verification, so this script
|
|
||||||
# is a no-op if the run actually succeeded.
|
|
||||||
if [ -f /run/rosenpass-linkb-ok ]; then
|
|
||||||
log "watchdog fired but /run/rosenpass-linkb-ok exists - no action taken"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "ROLLBACK triggered: Link B did not verify within the watchdog window"
|
|
||||||
|
|
||||||
systemctl disable --now rosenpass.service || log "warn: disable --now rosenpass failed"
|
|
||||||
|
|
||||||
if wg-quick strip wg0 > /run/wg0.rollback.stripped 2>/dev/null; then
|
|
||||||
if wg syncconf wg0 /run/wg0.rollback.stripped; then
|
|
||||||
log "wg0 synced from conf: static PresharedKeys restored for all peers"
|
|
||||||
else
|
|
||||||
log "ERROR: wg syncconf wg0 failed; live PSKs unchanged"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log "ERROR: wg-quick strip wg0 failed; live PSKs unchanged"
|
|
||||||
fi
|
|
||||||
rm -f /run/wg0.rollback.stripped
|
|
||||||
|
|
||||||
log "ROLLBACK done - verify: wg show wg0 latest-handshakes (rpi peer < 180 s)"
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Self-cancelling rollback for the Link B rollout (rpi wg-remote <-> linode wg0).
|
|
||||||
#
|
|
||||||
# Armed as a transient `systemd-run --on-active=420s` timer before rosenpass is
|
|
||||||
# started on the Linode. It must live on THIS host and act locally: a PSK
|
|
||||||
# mismatch on Link B kills the WireGuard tunnel, and that tunnel is the only SSH
|
|
||||||
# path to the far end, so no remote rollback can be delivered over it.
|
|
||||||
#
|
|
||||||
# Cancelled by touching /run/rosenpass-linkb-ok (checked by the timer unit's
|
|
||||||
# command, not here) once rotation and the cluster are verified.
|
|
||||||
#
|
|
||||||
# What it restores:
|
|
||||||
# 1. the pre-rollout rosenpass config (Link A peer only - Link A keeps working)
|
|
||||||
# 2. the static PresharedKey on the wg-remote peer, from /etc/wireguard/wg-remote.conf
|
|
||||||
#
|
|
||||||
# Never touches wg0 (Link A) or any client peer.
|
|
||||||
set -u
|
|
||||||
|
|
||||||
log() { logger -t rosenpass-linkb "$*"; echo "$*"; }
|
|
||||||
|
|
||||||
# Self-cancel: the operator touches this flag after verification, so this script
|
|
||||||
# is a no-op if the run actually succeeded.
|
|
||||||
if [ -f /run/rosenpass-linkb-ok ]; then
|
|
||||||
log "watchdog fired but /run/rosenpass-linkb-ok exists - no action taken"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "ROLLBACK triggered: Link B did not verify within the watchdog window"
|
|
||||||
|
|
||||||
# 1. Stop rosenpass first, so it cannot re-inject a rotating PSK mid-restore.
|
|
||||||
systemctl disable --now rosenpass.service || log "warn: disable --now rosenpass failed"
|
|
||||||
|
|
||||||
# 2. Put the Link A-only config back and bring Link A's rotation back up.
|
|
||||||
if [ -f /etc/rosenpass/config.toml.pre-linkb ]; then
|
|
||||||
cp -a /etc/rosenpass/config.toml.pre-linkb /etc/rosenpass/config.toml
|
|
||||||
log "restored /etc/rosenpass/config.toml from config.toml.pre-linkb"
|
|
||||||
else
|
|
||||||
log "warn: /etc/rosenpass/config.toml.pre-linkb missing; config left as-is"
|
|
||||||
fi
|
|
||||||
systemctl enable --now rosenpass.service || log "warn: restarting rosenpass failed"
|
|
||||||
|
|
||||||
# 3. Restore the static PSK on wg-remote from the conf (the rollback floor).
|
|
||||||
if wg-quick strip wg-remote > /run/wg-remote.rollback.stripped 2>/dev/null; then
|
|
||||||
if wg syncconf wg-remote /run/wg-remote.rollback.stripped; then
|
|
||||||
log "wg-remote synced from conf: static PresharedKey restored"
|
|
||||||
else
|
|
||||||
log "ERROR: wg syncconf wg-remote failed; live PSK unchanged"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log "ERROR: wg-quick strip wg-remote failed; live PSK unchanged"
|
|
||||||
fi
|
|
||||||
rm -f /run/wg-remote.rollback.stripped
|
|
||||||
|
|
||||||
log "ROLLBACK done - verify: wg show wg-remote latest-handshakes (expect < 180 s)"
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Sample Link B PSK hashes on both ends. Prints no key material: the preshared
|
|
||||||
# key line is filtered on each host and only its SHA-256 (first 16 hex) leaves.
|
|
||||||
set -u
|
|
||||||
LINKB_LINODE='/2Y0XpJYd9Vl9Al6zNAlQimEYA+xY9Y5PO6nUDkfKEA=' # linode wg0 pub (peer on the Pi)
|
|
||||||
LINKB_RPI='h1v1Rhrnq2N2kt454xQamL1Y1x0TaICa1zoKgyZHpkM=' # rpi wg-remote pub (peer on the linode)
|
|
||||||
LINKA='+e50qTPdZiyxMtYHRSdGILIrh06JflFQq5+TZRjVyic=' # siriussec (Link A sentinel)
|
|
||||||
|
|
||||||
h() { tr -d '\n' | sha256sum | cut -c1-16; }
|
|
||||||
|
|
||||||
ts=$(date -u +%FT%TZ)
|
|
||||||
|
|
||||||
pi_linkb=$(wg show wg-remote preshared-keys 2>/dev/null | grep -F "$LINKB_LINODE" | awk '{print $2}' | h)
|
|
||||||
pi_linka=$(wg show wg0 preshared-keys 2>/dev/null | grep -F "$LINKA" | awk '{print $2}' | h)
|
|
||||||
|
|
||||||
ln_linkb=$(ssh -n -i /home/sirius/.ssh/linode_admin -o BatchMode=yes -o ConnectTimeout=10 [email protected] \
|
|
||||||
"wg show wg0 preshared-keys | grep -F '$LINKB_RPI' | awk '{print \$2}'" | h)
|
|
||||||
|
|
||||||
pi_hs=$(wg show wg-remote latest-handshakes 2>/dev/null | grep -F "$LINKB_LINODE" | awk '{print $2}')
|
|
||||||
ln_hs=$(ssh -n -i /home/sirius/.ssh/linode_admin -o BatchMode=yes -o ConnectTimeout=10 [email protected] \
|
|
||||||
"wg show wg0 latest-handshakes | grep -F '$LINKB_RPI' | awk '{print \$2}'")
|
|
||||||
|
|
||||||
agree="MISMATCH"
|
|
||||||
[ "$pi_linkb" = "$ln_linkb" ] && agree="agree"
|
|
||||||
printf '%s linkB pi=%s linode=%s %s | linkA(pi)=%s | hs pi=%s linode=%s\n' \
|
|
||||||
"$ts" "$pi_linkb" "$ln_linkb" "$agree" "$pi_linka" "$pi_hs" "$ln_hs"
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Rosenpass health metrics for node-exporter (textfile collector)
|
|
||||||
Documentation=file:///usr/local/sbin/rosenpass-metrics.sh
|
|
||||||
# No Requires=/After= on rosenpass.service or [email protected] on purpose:
|
|
||||||
# the recorder has to keep running and keep exporting while the unit it watches
|
|
||||||
# is dead or the interface is down — a hard dependency would take the metric
|
|
||||||
# away exactly when it becomes the alert.
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/usr/local/sbin/rosenpass-metrics.sh
|
|
||||||
User=root
|
|
||||||
NoNewPrivileges=yes
|
|
||||||
ProtectSystem=strict
|
|
||||||
ProtectHome=yes
|
|
||||||
PrivateTmp=yes
|
|
||||||
# /var/lib/rosenpass-exporter (hash state) is created by systemd.
|
|
||||||
StateDirectory=rosenpass-exporter
|
|
||||||
# The textfile dir is shared with the node-exporter DaemonSet (hostPath). It is
|
|
||||||
# created by the install step; the leading `-` keeps the unit startable if a
|
|
||||||
# node has lost it (the node-exporter DirectoryOrCreate recreates it), instead
|
|
||||||
# of failing the whole unit with 226/NAMESPACE.
|
|
||||||
ReadWritePaths=-/var/lib/node-exporter/textfile
|
|
||||||
|
|
@ -1,141 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# rosenpass-metrics.sh — emit Rosenpass health metrics for node-exporter's
|
|
||||||
# textfile collector.
|
|
||||||
#
|
|
||||||
# Installed on rpi and siriussec (the two ends of Link A: rpi wg0 10.10.0.1 <->
|
|
||||||
# siriussec wg0 10.10.0.2), run every 60 s by rosenpass-metrics.timer as root.
|
|
||||||
# See README.md in this directory.
|
|
||||||
#
|
|
||||||
# Why a host script: kube-prometheus-stack-prometheus-node-exporter is
|
|
||||||
# distroless and ships without --collector.textfile.directory (and without the
|
|
||||||
# dbus plumbing --collector.systemd needs), so nothing inside the cluster can
|
|
||||||
# observe a host systemd unit. This writes a textfile that the DaemonSet's
|
|
||||||
# textfile collector then serves on :9100/metrics.
|
|
||||||
#
|
|
||||||
# Signals:
|
|
||||||
# rosenpass_unit_active{node}
|
|
||||||
# 1 when `systemctl is-active rosenpass.service`
|
|
||||||
# says active, else 0.
|
|
||||||
# rosenpass_psk_rotation_age_seconds{node,interface}
|
|
||||||
# seconds since that interface's preshared-key set
|
|
||||||
# last changed. Rotation runs about every two minutes.
|
|
||||||
# rosenpass_psk_rotation_last_change_timestamp_seconds{node,interface}
|
|
||||||
# unix timestamp of that last observed change.
|
|
||||||
# rosenpass_upnp_mapping_present{node}
|
|
||||||
# 1/0 state that rosenpass-upnp.sh stamped on its
|
|
||||||
# last run (Link B's only inbound path on the Pi).
|
|
||||||
# Only emitted where that unit runs: no state file,
|
|
||||||
# no series, so siriussec does not advertise it.
|
|
||||||
# rosenpass_upnp_last_check_timestamp_seconds{node}
|
|
||||||
# unix mtime of that state file, so a stopped
|
|
||||||
# rosenpass-upnp.timer reads as stale rather than as
|
|
||||||
# a flat healthy 1.
|
|
||||||
#
|
|
||||||
# Interfaces are emitted independently: wg0 is Link A (rpi <-> siriussec) and
|
|
||||||
# wg-remote is Link B (rpi <-> linode, through a permanent UPnP mapping on a
|
|
||||||
# router with no admin access). Link B stalls silently if the Pi's residential
|
|
||||||
# public address moves, so it needs its own series — hashing only wg0 leaves
|
|
||||||
# Link B unobserved.
|
|
||||||
#
|
|
||||||
# The preshared key is NEVER printed, logged or stored: each interface's key
|
|
||||||
# listing is piped straight into sha256sum and only the hex digest is kept, in a
|
|
||||||
# root-only state file. Do not add an `echo` of the listing while debugging.
|
|
||||||
#
|
|
||||||
# Deliberately independent of rosenpass.service: this script must keep
|
|
||||||
# reporting (unit_active=0, age growing) while the thing it watches is dead.
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
NODE=$(hostname -s)
|
|
||||||
# Interfaces rosenpass manages on this host. One absent here is skipped, so the
|
|
||||||
# same file is correct on rpi (wg0 + wg-remote) and siriussec (wg0 only).
|
|
||||||
IFACES="wg0 wg-remote"
|
|
||||||
UNIT=rosenpass.service
|
|
||||||
|
|
||||||
STATE_DIR=/var/lib/rosenpass-exporter
|
|
||||||
OUT_DIR=/var/lib/node-exporter/textfile
|
|
||||||
OUT_FILE=$OUT_DIR/rosenpass.prom
|
|
||||||
|
|
||||||
# 0644 so the node-exporter container (nobody/65534) can read the file and the
|
|
||||||
# directory stays traversable.
|
|
||||||
umask 022
|
|
||||||
mkdir -p "$STATE_DIR" "$OUT_DIR"
|
|
||||||
|
|
||||||
now=$(date +%s)
|
|
||||||
|
|
||||||
# --- 1. unit state -----------------------------------------------------------
|
|
||||||
active=0
|
|
||||||
if [ "$(systemctl is-active "$UNIT" 2>/dev/null || true)" = "active" ]; then
|
|
||||||
active=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- 2. UPnP mapping state (Link B inbound path) -----------------------------
|
|
||||||
# rosenpass-upnp.sh stamps 1/0 into /run on each of its 15-min runs. This timer
|
|
||||||
# must NOT call upnpc itself: that would poll the IGD 1440x/day and put the
|
|
||||||
# fragile component in the hot path. No state file means this host does not run
|
|
||||||
# that unit (siriussec), so emit nothing there.
|
|
||||||
UPNP_STATE=/run/rosenpass-upnp.present
|
|
||||||
upnp=""
|
|
||||||
upnp_ts=""
|
|
||||||
if [ -r "$UPNP_STATE" ]; then
|
|
||||||
upnp=$(head -n 1 "$UPNP_STATE" 2>/dev/null | tr -d '[:space:]')
|
|
||||||
case "$upnp" in
|
|
||||||
0 | 1) upnp_ts=$(stat -c %Y "$UPNP_STATE" 2>/dev/null || echo "$now") ;;
|
|
||||||
*) upnp="" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- 3. PSK rotation, per interface -----------------------------------------
|
|
||||||
# `wg show ... preshared-keys` fails (and prints nothing) when the interface is
|
|
||||||
# absent; command substitution would otherwise hash an empty string, which looks
|
|
||||||
# like a change on the first poll after the interface returns. Only hash real
|
|
||||||
# output, and keep one state file per interface so a Link B rotation is never
|
|
||||||
# recorded as a Link A one.
|
|
||||||
tmp="$OUT_FILE.$$"
|
|
||||||
{
|
|
||||||
printf '# HELP rosenpass_unit_active rosenpass.service is active (1) or not (0).\n'
|
|
||||||
printf '# TYPE rosenpass_unit_active gauge\n'
|
|
||||||
printf 'rosenpass_unit_active{node="%s"} %s\n' "$NODE" "$active"
|
|
||||||
|
|
||||||
if [ -n "$upnp" ]; then
|
|
||||||
printf '# HELP rosenpass_upnp_mapping_present The Link B UPnP mapping (UDP 9999 -> rpi) is present (1) or missing (0), as of the last rosenpass-upnp.sh run.\n'
|
|
||||||
printf '# TYPE rosenpass_upnp_mapping_present gauge\n'
|
|
||||||
printf 'rosenpass_upnp_mapping_present{node="%s"} %s\n' "$NODE" "$upnp"
|
|
||||||
printf '# HELP rosenpass_upnp_last_check_timestamp_seconds Unix timestamp of the last rosenpass-upnp.sh run that wrote the state file.\n'
|
|
||||||
printf '# TYPE rosenpass_upnp_last_check_timestamp_seconds gauge\n'
|
|
||||||
printf 'rosenpass_upnp_last_check_timestamp_seconds{node="%s"} %s\n' "$NODE" "$upnp_ts"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf '# HELP rosenpass_psk_rotation_age_seconds Seconds since that interface preshared-key set last changed.\n'
|
|
||||||
printf '# TYPE rosenpass_psk_rotation_age_seconds gauge\n'
|
|
||||||
printf '# HELP rosenpass_psk_rotation_last_change_timestamp_seconds Unix timestamp of the last observed preshared-key change on that interface.\n'
|
|
||||||
printf '# TYPE rosenpass_psk_rotation_last_change_timestamp_seconds gauge\n'
|
|
||||||
|
|
||||||
for IFACE in $IFACES; do
|
|
||||||
psk_list=$(wg show "$IFACE" preshared-keys 2>/dev/null || true)
|
|
||||||
[ -n "$psk_list" ] || continue
|
|
||||||
|
|
||||||
STATE_FILE=$STATE_DIR/last-hash-$IFACE
|
|
||||||
last_hash=""
|
|
||||||
last_change=""
|
|
||||||
if [ -f "$STATE_FILE" ]; then
|
|
||||||
last_hash=$(sed -n '1p' "$STATE_FILE")
|
|
||||||
last_change=$(sed -n '2p' "$STATE_FILE")
|
|
||||||
fi
|
|
||||||
|
|
||||||
hash_now=$(printf '%s' "$psk_list" | sha256sum | awk '{print $1}')
|
|
||||||
if [ "$hash_now" != "$last_hash" ]; then
|
|
||||||
# First observation or an actual rotation: stamp it.
|
|
||||||
last_change=$now
|
|
||||||
printf '%s\n%s\n' "$hash_now" "$last_change" > "$STATE_FILE.tmp"
|
|
||||||
mv "$STATE_FILE.tmp" "$STATE_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "$last_change" ] || continue
|
|
||||||
age=$((now - last_change))
|
|
||||||
[ "$age" -ge 0 ] || age=0
|
|
||||||
printf 'rosenpass_psk_rotation_age_seconds{node="%s",interface="%s"} %s\n' "$NODE" "$IFACE" "$age"
|
|
||||||
printf 'rosenpass_psk_rotation_last_change_timestamp_seconds{node="%s",interface="%s"} %s\n' "$NODE" "$IFACE" "$last_change"
|
|
||||||
done
|
|
||||||
} > "$tmp"
|
|
||||||
chmod 0644 "$tmp"
|
|
||||||
mv "$tmp" "$OUT_FILE"
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Collect Rosenpass health metrics every 60s
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=30s
|
|
||||||
OnUnitActiveSec=60s
|
|
||||||
AccuracySec=5s
|
|
||||||
Unit=rosenpass-metrics.service
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Re-assert UPnP mapping for Rosenpass Link B (UDP 9999 -> rpi)
|
|
||||||
Documentation=https://github.com/rosenpass/rosenpass
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/usr/local/sbin/rosenpass-upnp.sh
|
|
||||||
# A router reboot drops the mapping; retry a few times before giving up so a
|
|
||||||
# transient WAN/IGD hiccup does not page anyone.
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=30s
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# rosenpass-upnp.sh - re-assert the permanent UPnP mapping that gives the
|
|
||||||
# Linode a way back to Rosenpass on the Pi (UDP 9999 -> 192.168.1.125:9999).
|
|
||||||
#
|
|
||||||
# The home router's admin panel is inaccessible, so this mapping is the ONLY
|
|
||||||
# inbound path for the Rosenpass exchange on Link B (rpi wg-remote <->
|
|
||||||
# linode wg0). It is runtime state: a router reboot, a factory reset or a UPnP
|
|
||||||
# daemon hiccup drops it, and the failure is silent - the link keeps its last
|
|
||||||
# PSK and simply stops being post-quantum. Hence this timer.
|
|
||||||
#
|
|
||||||
# Idempotent: re-adding an identical permanent-lease mapping is a no-op, so it
|
|
||||||
# is safe to run on a schedule. Never prints key material (it handles none).
|
|
||||||
set -uo pipefail
|
|
||||||
|
|
||||||
LAN_IP=192.168.1.125
|
|
||||||
PORT=9999
|
|
||||||
DESC=rosenpass-pq
|
|
||||||
# Result of this run, read by rosenpass-metrics.sh (60 s textfile collector) so
|
|
||||||
# the mapping is observable without polling the IGD from that timer. /run is
|
|
||||||
# tmpfs: on a reboot the file is gone and the metric is absent until this unit
|
|
||||||
# runs again (OnBootSec=2min), which the alert treats as "unknown", not "lost".
|
|
||||||
STATE=/run/rosenpass-upnp.present
|
|
||||||
|
|
||||||
set_present() {
|
|
||||||
printf '%s\n' "$1" > "$STATE.tmp" && mv "$STATE.tmp" "$STATE"
|
|
||||||
}
|
|
||||||
|
|
||||||
out=$(upnpc -e "$DESC" -a "$LAN_IP" "$PORT" "$PORT" UDP 0 2>&1) || true
|
|
||||||
|
|
||||||
# upnpc prints the mapping as " 0 UDP 9999->192.168.1.125:9999 'rosenpass-pq'"
|
|
||||||
if ! upnpc -l 2>/dev/null | grep -q "${PORT}->${LAN_IP}:${PORT}"; then
|
|
||||||
set_present 0
|
|
||||||
logger -t rosenpass-upnp "mapping missing after re-assert: ${out}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set_present 1
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Re-assert the Rosenpass Link B UPnP mapping every 15 minutes
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=2min
|
|
||||||
OnUnitActiveSec=15min
|
|
||||||
AccuracySec=30s
|
|
||||||
Unit=rosenpass-upnp.service
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
|
|
@ -196,21 +196,16 @@ def loki_runner_ns_variable():
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------- runners -----
|
# ---------------------------------------------------------------- runners -----
|
||||||
# The CI capsule moved out of `forgejo` (card t_2bbe34a8, PSA baseline there) into
|
|
||||||
# `ci-runners`; every pod/PVC/Deployment target below uses this namespace. The
|
|
||||||
# `cnpg_actions_*` queue/jobs targets keep namespace="forgejo" — that is the
|
|
||||||
# Forgejo *database*, not the runners. Do not conflate the two.
|
|
||||||
CI_RUNNERS_NS = 'ci-runners'
|
|
||||||
# Only the three runner Deployments' pods. `forgejo-runner-.*` also matches the
|
# Only the three runner Deployments' pods. `forgejo-runner-.*` also matches the
|
||||||
# `forgejo-runner-prune-*` CronJob pods, which are Completed and permanently
|
# `forgejo-runner-prune-*` CronJob pods, which are Completed and permanently
|
||||||
# "not Ready" — that turned a 0 into a 3 on the not-Ready stat.
|
# "not Ready" — that turned a 0 into a 3 on the not-Ready stat.
|
||||||
RUN = 'namespace="%s",pod=~"forgejo-runner-(amd64|arm64|deploy-arm64)-.*"' % CI_RUNNERS_NS
|
RUN = 'namespace="ci-runners",pod=~"forgejo-runner-(amd64|arm64|deploy-arm64)-.*"'
|
||||||
SIRIUSSEC_FS = 'instance="10.10.0.2:9100",mountpoint="/"'
|
SIRIUSSEC_FS = 'instance="10.10.0.2:9100",mountpoint="/"'
|
||||||
RPI_FS = 'instance="10.10.0.1:9100",mountpoint="/"'
|
RPI_FS = 'instance="10.10.0.1:9100",mountpoint="/"'
|
||||||
|
|
||||||
runners = [
|
runners = [
|
||||||
row("Runners & queue", 0),
|
row("Runners & queue", 0),
|
||||||
stat("Runner pods Ready", [target('sum(kube_deployment_status_replicas_ready{namespace="%s",deployment=~"forgejo-runner-.*"}) or vector(0)' % CI_RUNNERS_NS)],
|
stat("Runner pods Ready", [target('sum(kube_deployment_status_replicas_ready{namespace="ci-runners",deployment=~"forgejo-runner-.*"}) or vector(0)')],
|
||||||
{"h": 5, "w": 4, "x": 0, "y": 1}, desc="replicas_ready summed across the three runner Deployments. Expected 3.",
|
{"h": 5, "w": 4, "x": 0, "y": 1}, desc="replicas_ready summed across the three runner Deployments. Expected 3.",
|
||||||
thresholds=[{"color": "red", "value": None}, {"color": "yellow", "value": 2}, {"color": "green", "value": 3}]),
|
thresholds=[{"color": "red", "value": None}, {"color": "yellow", "value": 2}, {"color": "green", "value": 3}]),
|
||||||
stat("Runner pods not Ready", [target('sum(kube_pod_status_ready{%s,condition="false"} == 1) or vector(0)' % RUN)],
|
stat("Runner pods not Ready", [target('sum(kube_pod_status_ready{%s,condition="false"} == 1) or vector(0)' % RUN)],
|
||||||
|
|
@ -262,7 +257,7 @@ runners = [
|
||||||
ts("Runner pod network I/O", [target('sum by (pod) (rate(container_network_receive_bytes_total{%s}[5m]))' % RUN, "{{pod}} in"),
|
ts("Runner pod network I/O", [target('sum by (pod) (rate(container_network_receive_bytes_total{%s}[5m]))' % RUN, "{{pod}} in"),
|
||||||
target('sum by (pod) (rate(container_network_transmit_bytes_total{%s}[5m]))' % RUN, "{{pod}} out", ref="B")],
|
target('sum by (pod) (rate(container_network_transmit_bytes_total{%s}[5m]))' % RUN, "{{pod}} out", ref="B")],
|
||||||
{"h": 8, "w": 8, "x": 0, "y": 25}, unit="Bps", desc="Image pulls and artifact traffic through the pod interface."),
|
{"h": 8, "w": 8, "x": 0, "y": 25}, unit="Bps", desc="Image pulls and artifact traffic through the pod interface."),
|
||||||
stat("dind PVC nominal size", [target('max(kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace="%s",persistentvolumeclaim="forgejo-runner-amd64"})' % CI_RUNNERS_NS)],
|
stat("dind PVC nominal size", [target('max(kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace="ci-runners",persistentvolumeclaim="forgejo-runner-amd64"})')],
|
||||||
{"h": 8, "w": 4, "x": 8, "y": 25}, unit="bytes",
|
{"h": 8, "w": 4, "x": 8, "y": 25}, unit="bytes",
|
||||||
desc="Requested size of the forgejo-runner-amd64 PVC (docker data-root + named CI volumes). This is the ceiling, not the usage — see the note on this row."),
|
desc="Requested size of the forgejo-runner-amd64 PVC (docker data-root + named CI volumes). This is the ceiling, not the usage — see the note on this row."),
|
||||||
stat("siriussec root fs used", [target('100 * (1 - node_filesystem_avail_bytes{%s} / node_filesystem_size_bytes{%s})' % (SIRIUSSEC_FS, SIRIUSSEC_FS))],
|
stat("siriussec root fs used", [target('100 * (1 - node_filesystem_avail_bytes{%s} / node_filesystem_size_bytes{%s})' % (SIRIUSSEC_FS, SIRIUSSEC_FS))],
|
||||||
|
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
# Egress lockdown for the nightly Grafana sqlite snapshot (card t_9d0428d8).
|
|
||||||
#
|
|
||||||
# Why: grafana-backup used to run `apk add --no-cache rsync openssh-client` at
|
|
||||||
# container start, so every night it dialled the Alpine CDN
|
|
||||||
# (dl-cdn.alpinelinux.org -> Fastly 151.101.x.132:443) and kept firing the
|
|
||||||
# `egress-new-dst` flow alert whenever that anycast address rotated. The
|
|
||||||
# toolchain is now baked into the image (images/backup/Dockerfile) and this
|
|
||||||
# policy makes any future runtime fetch fail loudly instead of silently
|
|
||||||
# reaching the internet.
|
|
||||||
#
|
|
||||||
# `monitoring` has no namespace-wide default-deny, so selecting the backup pod
|
|
||||||
# here isolates it on its own: the rules below are the complete egress allow
|
|
||||||
# list and everything else (including `world`) is dropped. `egressDeny` is
|
|
||||||
# stated explicitly so the intent survives a future namespace-wide allow being
|
|
||||||
# added — Cilium deny always beats allow.
|
|
||||||
#
|
|
||||||
# Needs: cluster DNS (the script resolves nothing itself, but the image and any
|
|
||||||
# `ssh` target lookup would), and [email protected]:22 — that is the Linode node's
|
|
||||||
# InternalIP, so Cilium classifies it `remote-node`, not `world`. The registry
|
|
||||||
# pull and the Grafana PVC access are not pod traffic and are unaffected.
|
|
||||||
apiVersion: cilium.io/v2
|
|
||||||
kind: CiliumNetworkPolicy
|
|
||||||
metadata:
|
|
||||||
name: grafana-backup-egress
|
|
||||||
namespace: monitoring
|
|
||||||
labels:
|
|
||||||
app: grafana-backup
|
|
||||||
spec:
|
|
||||||
description: >-
|
|
||||||
grafana-backup pod: cluster DNS + SSH to the backup host (10.10.0.5:22)
|
|
||||||
only; no internet egress at run time.
|
|
||||||
endpointSelector:
|
|
||||||
matchLabels:
|
|
||||||
app: grafana-backup
|
|
||||||
egress:
|
|
||||||
- toEndpoints:
|
|
||||||
- matchLabels:
|
|
||||||
io.kubernetes.pod.namespace: kube-system
|
|
||||||
k8s-app: kube-dns
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "53"
|
|
||||||
protocol: UDP
|
|
||||||
- port: "53"
|
|
||||||
protocol: TCP
|
|
||||||
- toEntities:
|
|
||||||
- remote-node
|
|
||||||
toPorts:
|
|
||||||
- ports:
|
|
||||||
- port: "22"
|
|
||||||
protocol: TCP
|
|
||||||
egressDeny:
|
|
||||||
- toEntities:
|
|
||||||
- world
|
|
||||||
|
|
@ -27,10 +27,10 @@ data:
|
||||||
# T480's root filesystem, the only local file is a ~3 MB copy in /tmp.
|
# T480's root filesystem, the only local file is a ~3 MB copy in /tmp.
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# No package install here on purpose: rsync/openssh-client/python3 are
|
if ! command -v rsync >/dev/null || ! command -v ssh >/dev/null; then
|
||||||
# baked into the pinned image (images/backup/Dockerfile) and this pod's
|
echo "== installing rsync + openssh-client"
|
||||||
# egress policy admits DNS + 10.10.0.5:22 only, so a runtime fetch would
|
apk add --no-cache rsync openssh-client >/dev/null
|
||||||
# fail rather than silently dial the Alpine CDN (card t_9d0428d8).
|
fi
|
||||||
|
|
||||||
BACKUP_HOST=${BACKUP_HOST:[email protected]}
|
BACKUP_HOST=${BACKUP_HOST:[email protected]}
|
||||||
BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup}
|
BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup}
|
||||||
|
|
@ -128,22 +128,15 @@ spec:
|
||||||
app: grafana-backup
|
app: grafana-backup
|
||||||
spec:
|
spec:
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
# Pulled from the in-cluster Forgejo registry (which requires auth);
|
|
||||||
# monitoring had no registry pull secret before this job needed one.
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: forgejo-pull
|
|
||||||
# The grafana PVC is local-path on siriussec; RWO still allows a
|
# The grafana PVC is local-path on siriussec; RWO still allows a
|
||||||
# second pod on the same node.
|
# second pod on the same node.
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/hostname: siriussec
|
kubernetes.io/hostname: siriussec
|
||||||
containers:
|
containers:
|
||||||
- name: backup
|
- name: backup
|
||||||
# python3.12-alpine + rsync + openssh-client, baked at build time
|
# python3 alpine: the sqlite backup API is the only consistent
|
||||||
# and pinned by digest (images/backup/Dockerfile, CI workflow
|
# way to copy a live database without a shell inside Grafana.
|
||||||
# .forgejo/workflows/backup-image.yml). The sqlite backup API is
|
image: python:3.12-alpine
|
||||||
# the only consistent way to copy a live database without a shell
|
|
||||||
# inside Grafana. Nothing is installed at run time.
|
|
||||||
image: forgejo.siriusdevops.com/sirius/backup-tools@sha256:cc8dc1645111b3a80b7c4d5168f6bce3002cae7417b3725683c057976f6e379a
|
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command: ["/bin/sh", "/scripts/backup.sh"]
|
command: ["/bin/sh", "/scripts/backup.sh"]
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -7,28 +7,14 @@
|
||||||
# sample. These rules make the loss visible and define the gate: a window whose
|
# sample. These rules make the loss visible and define the gate: a window whose
|
||||||
# lost-event count is non-zero is NOT clean and must not be reported as such.
|
# lost-event count is non-zero is NOT clean and must not be reported as such.
|
||||||
#
|
#
|
||||||
# Two very different things share the `hubble_lost_events_total` counter and they
|
# Measured loss here is `hubble_lost_events_total{source="hubble_ring_buffer"}`,
|
||||||
# must not share a threshold:
|
# the only source that has ever been non-zero on this cluster
|
||||||
|
# (`perf_event_ring_buffer` and `observer_events_queue` are 0). It is a plain
|
||||||
|
# counter on each agent's :9965, scraped by the `hubble-metrics` job.
|
||||||
#
|
#
|
||||||
# perf_event_ring_buffer / observer_events_queue
|
# Thresholds:
|
||||||
# Real loss on the way in — the BPF perf ring dropped an event, or the
|
# gate : increase over 30 m > 0 events -> warning, window tainted
|
||||||
# metrics exporter fell behind. Steady state is 0 on every node. Any
|
# material : lost / processed Trace flows > 0.1 % -> critical, real loss
|
||||||
# increase over the window taints that window.
|
|
||||||
#
|
|
||||||
# hubble_ring_buffer
|
|
||||||
# NOT a drop. `Ring.read()` synthesises a LostEvent and bumps this counter
|
|
||||||
# whenever a read falls outside the ring's retained window, which the
|
|
||||||
# agent's own 5 s health probe and every `hubble status` / Hubble UI status
|
|
||||||
# request do on a ring holding < 60 s of flows (cilium#46584, still open in
|
|
||||||
# the deployed 1.20.1). A couple of UI reads per hour is ~0.001 events/s and
|
|
||||||
# means nothing; the 12/min probe storm measured in F10 was ~0.2 events/s.
|
|
||||||
# So this source is alerted on a *rate*, never on `increase() > 0`.
|
|
||||||
#
|
|
||||||
# Recorders:
|
|
||||||
# hubble:lost_events_increase_30m real loss only, per (node, source), so the
|
|
||||||
# alert can name which source lost events.
|
|
||||||
# hubble:ring_buffer_read_rate_15m read churn on the ring, events/s per node.
|
|
||||||
# hubble:flows_processed_increase_30m denominator for the material ratio.
|
|
||||||
# The detector contract (docs/hubble-event-loss.md §"Gate") is: read
|
# The detector contract (docs/hubble-event-loss.md §"Gate") is: read
|
||||||
# `hubble:lost_events_increase_30m` with the same window as the traffic it is
|
# `hubble:lost_events_increase_30m` with the same window as the traffic it is
|
||||||
# judging; if it is > 0, label the window incomplete instead of clean.
|
# judging; if it is > 0, label the window incomplete instead of clean.
|
||||||
|
|
@ -43,21 +29,11 @@ spec:
|
||||||
groups:
|
groups:
|
||||||
- name: hubble-event-loss
|
- name: hubble-event-loss
|
||||||
rules:
|
rules:
|
||||||
# One number for the gate, from the two sources that mean real loss.
|
# One number for the gate. `increase()` absorbs the counter reset that
|
||||||
# `increase()` absorbs the counter reset that an agent restart causes,
|
# an agent restart causes, so a rolled DaemonSet does not look like loss.
|
||||||
# so a rolled DaemonSet does not look like loss. Empty source filter out
|
|
||||||
# of scope: a source that starts reporting is a loss, not a read.
|
|
||||||
- record: hubble:lost_events_increase_30m
|
- record: hubble:lost_events_increase_30m
|
||||||
expr: |
|
expr: |
|
||||||
sum by (node, source) (
|
sum by (node) (increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m]))
|
||||||
increase(hubble_lost_events_total{source=~"perf_event_ring_buffer|observer_events_queue"}[30m])
|
|
||||||
)
|
|
||||||
# Ring-buffer read churn, kept separate and rate-based. 0.05 events/s =
|
|
||||||
# 45 reads per 15 min; the F10 probe storm was ~0.2/s, two UI reads an
|
|
||||||
# hour is ~0.001/s.
|
|
||||||
- record: hubble:ring_buffer_read_rate_15m
|
|
||||||
expr: |
|
|
||||||
sum by (node) (rate(hubble_lost_events_total{source="hubble_ring_buffer"}[15m]))
|
|
||||||
# Denominator for the material-loss ratio. Trace is the total flow
|
# Denominator for the material-loss ratio. Trace is the total flow
|
||||||
# counter; L7/Drop/PolicyVerdict are subsets of it and would
|
# counter; L7/Drop/PolicyVerdict are subsets of it and would
|
||||||
# double-count.
|
# double-count.
|
||||||
|
|
@ -66,68 +42,35 @@ spec:
|
||||||
sum by (node) (increase(hubble_flows_processed_total{type="Trace"}[30m]))
|
sum by (node) (increase(hubble_flows_processed_total{type="Trace"}[30m]))
|
||||||
|
|
||||||
- alert: HubbleFlowWindowIncomplete
|
- alert: HubbleFlowWindowIncomplete
|
||||||
# The gate from F10: any event lost on the way in during the window
|
# The gate from F10. Any lost event in the window means a flow-shaped
|
||||||
# means a flow-shaped detector may have missed something, so the window
|
# detector may have missed something; the window must not be reported
|
||||||
# must not be reported as clean. Steady state is 0 on all three nodes.
|
# as clean. Steady state is 0 on all three nodes after the ring-depth
|
||||||
# Ring-buffer read artefacts are deliberately NOT in this expression —
|
# fix (16383) — this firing means either a regression of that fix or a
|
||||||
# they are not loss and are covered by HubbleRingBufferReadChurn.
|
# genuinely overloaded agent, both of which invalidate flow-only
|
||||||
|
# silence.
|
||||||
expr: hubble:lost_events_increase_30m > 0
|
expr: hubble:lost_events_increase_30m > 0
|
||||||
for: 10m
|
for: 10m
|
||||||
labels:
|
labels:
|
||||||
severity: warning
|
severity: warning
|
||||||
component: hubble
|
component: hubble
|
||||||
annotations:
|
annotations:
|
||||||
summary: "Hubble lost flow events on {{ $labels.node }} (source: {{ $labels.source }}) — flow windows are not clean"
|
summary: "Hubble dropped flow events on {{ $labels.node }} — flow windows are not clean"
|
||||||
description: |
|
description: |
|
||||||
hubble_lost_events_total{source="{{ $labels.source }}"} on {{ $labels.node }}
|
hubble_lost_events_total{source="hubble_ring_buffer"} on {{ $labels.node }}
|
||||||
increased by {{ $value | printf "%.0f" }} events over the last 30 min.
|
increased by {{ $value | printf "%.0f" }} events over the last 30 min.
|
||||||
That source is real loss: `perf_event_ring_buffer` means the BPF perf
|
A flow-based detector cannot claim "no anomalous traffic" for this window.
|
||||||
ring dropped an event on the way in, `observer_events_queue` means the
|
Check `kubectl -n kube-system exec <cilium-agent> -c cilium-agent --
|
||||||
metrics exporter fell behind. A flow-based detector cannot claim
|
hubble status` (Current/Max Flows) and the agent's flow rate against
|
||||||
"no anomalous traffic" for this window.
|
|
||||||
Check the agent's flow rate against hubble.eventBufferCapacity in
|
|
||||||
infrastructure/networking/cilium/values.yaml, and look for an
|
|
||||||
overloaded node.
|
|
||||||
|
|
||||||
- alert: HubbleRingBufferReadChurn
|
|
||||||
# Regression guard for the artefact described in F10, not evidence of
|
|
||||||
# loss. The 5 s health probe / `hubble status` / Hubble UI status walk
|
|
||||||
# the ring backwards over a full minute; on a ring holding < 60 s of
|
|
||||||
# flows each walk increments hubble_lost_events_total
|
|
||||||
# {source="hubble_ring_buffer"} by 1. A handful of reads is normal; the
|
|
||||||
# old probe storm (12/min = 0.2/s) and an agent whose ring no longer
|
|
||||||
# holds a minute of flows are not. Rate, not increase: `increase() > 0`
|
|
||||||
# fires forever on two UI reads an hour.
|
|
||||||
expr: hubble:ring_buffer_read_rate_15m > 0.05
|
|
||||||
for: 10m
|
|
||||||
labels:
|
|
||||||
severity: warning
|
|
||||||
component: hubble
|
|
||||||
annotations:
|
|
||||||
summary: "Hubble ring-buffer read churn on {{ $labels.node }} (source: hubble_ring_buffer) — reads, not dropped flows"
|
|
||||||
description: |
|
|
||||||
hubble_lost_events_total{source="hubble_ring_buffer"} is increasing at
|
|
||||||
{{ $value | printf "%.3f" }}/s on {{ $labels.node }} (threshold 0.05/s,
|
|
||||||
15 min rate, sustained 10 min). This counter also counts reads that
|
|
||||||
fall outside the ring's retained window (cilium#46584), so a burst of
|
|
||||||
`hubble status` / Hubble UI / relay calls can move it without anything
|
|
||||||
being dropped. A sustained rate this high means either a status-call
|
|
||||||
storm or a ring holding less than one minute of flows — check
|
|
||||||
`hubble status` (Current/Max Flows) against the agent's flow rate and
|
|
||||||
hubble.eventBufferCapacity in infrastructure/networking/cilium/values.yaml.
|
hubble.eventBufferCapacity in infrastructure/networking/cilium/values.yaml.
|
||||||
Confirm whether it is real loss by checking
|
|
||||||
HubbleFlowWindowIncomplete (perf/observer sources), which stays 0 for
|
|
||||||
read churn alone.
|
|
||||||
|
|
||||||
- alert: HubbleFlowLossMaterial
|
- alert: HubbleFlowLossMaterial
|
||||||
# Escalation: real loss that is large relative to the traffic, not a
|
# Escalation: loss that is large relative to the traffic, not a
|
||||||
# boundary artefact. 0.1 % of 30 min of flows on siriussec (~180 k
|
# boundary artefact. 0.1 % of 30 min of flows on siriussec (~180 k
|
||||||
# events) is ~180 events — small enough to catch a real gap, large
|
# events) is ~180 events — small enough to catch a real gap, large
|
||||||
# enough that a handful of stray increments do not page. Uses the
|
# enough that a handful of stray increments do not page.
|
||||||
# real-loss recorder only; ring-buffer reads never make this ratio.
|
|
||||||
expr: |
|
expr: |
|
||||||
(
|
(
|
||||||
sum by (node) (hubble:lost_events_increase_30m)
|
hubble:lost_events_increase_30m
|
||||||
/
|
/
|
||||||
(hubble:flows_processed_increase_30m > 0)
|
(hubble:flows_processed_increase_30m > 0)
|
||||||
) > 0.001
|
) > 0.001
|
||||||
|
|
@ -139,8 +82,7 @@ spec:
|
||||||
summary: "Hubble is losing a material share of flows on {{ $labels.node }}"
|
summary: "Hubble is losing a material share of flows on {{ $labels.node }}"
|
||||||
description: |
|
description: |
|
||||||
{{ $labels.node }} has lost more than 0.1% of the flows it processed
|
{{ $labels.node }} has lost more than 0.1% of the flows it processed
|
||||||
over the last 30 min (ratio {{ $value | humanizePercentage }}), from the
|
over the last 30 min (ratio {{ $value | humanizePercentage }}).
|
||||||
real-loss sources (`perf_event_ring_buffer` / `observer_events_queue`).
|
|
||||||
Treat every flow-based conclusion for this node as partial until
|
Treat every flow-based conclusion for this node as partial until
|
||||||
`hubble:lost_events_increase_30m` returns to 0.
|
`hubble:lost_events_increase_30m` returns to 0.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,8 @@ resources:
|
||||||
- prune-alerts.yaml
|
- prune-alerts.yaml
|
||||||
# Flow-loss gate + material-loss alerts for the Hubble sensor (audit F10).
|
# Flow-loss gate + material-loss alerts for the Hubble sensor (audit F10).
|
||||||
- hubble-loss-gate.yaml
|
- hubble-loss-gate.yaml
|
||||||
# Rosenpass unit-state + PSK-rotation alerts for Link A (rpi <-> siriussec).
|
|
||||||
# Series come from a host textfile exporter (infrastructure/networking/rosenpass/),
|
|
||||||
# so silently missing data is itself an alert.
|
|
||||||
- rosenpass.yaml
|
|
||||||
# Analyst freshness: OsintAnalystStale + OsintIngestAliveButNoBrief, built on
|
|
||||||
# the osint-analyst-exporter timestamps (card t_22334588).
|
|
||||||
- osint-analyst.yaml
|
|
||||||
# Nightly consistent sqlite snapshot of Grafana's dashboards/alerts/users.
|
# Nightly consistent sqlite snapshot of Grafana's dashboards/alerts/users.
|
||||||
- grafana-backup.yaml
|
- grafana-backup.yaml
|
||||||
# Egress lockdown for that backup pod: DNS + the backup host only, so no
|
|
||||||
# run-time package fetch (card t_9d0428d8).
|
|
||||||
- grafana-backup-networkpolicy.yaml
|
|
||||||
- dashboards
|
- dashboards
|
||||||
# Secrets, SOPS/age-encrypted in git (decrypted by the `monitoring`
|
# Secrets, SOPS/age-encrypted in git (decrypted by the `monitoring`
|
||||||
# Kustomization; key = flux-system/sops-age). See docs/secrets-sops.md.
|
# Kustomization; key = flux-system/sops-age). See docs/secrets-sops.md.
|
||||||
|
|
@ -30,10 +20,6 @@ resources:
|
||||||
- secret-grafana-secret-key.sops.yaml
|
- secret-grafana-secret-key.sops.yaml
|
||||||
- secret-alertmanager-telegram.sops.yaml
|
- secret-alertmanager-telegram.sops.yaml
|
||||||
- secret-cluster-backup-ssh.sops.yaml
|
- secret-cluster-backup-ssh.sops.yaml
|
||||||
# Registry pull credential for this namespace. Added because grafana-backup
|
|
||||||
# now runs an image from the in-cluster Forgejo registry instead of
|
|
||||||
# python:3.12-alpine from Docker Hub (card t_9d0428d8).
|
|
||||||
- secret-forgejo-pull.sops.yaml
|
|
||||||
|
|
||||||
configMapGenerator:
|
configMapGenerator:
|
||||||
- name: kube-prometheus-stack-values
|
- name: kube-prometheus-stack-values
|
||||||
|
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
# osint analyst freshness -> Prometheus (card t_22334588)
|
|
||||||
#
|
|
||||||
# On 2026-11-25 the analyst (deploy/osint-news-summarizer) silently stopped
|
|
||||||
# writing article_summaries and stayed dead for nine days. The scraper kept
|
|
||||||
# ingesting normally (61.5k rows in articles, newest within minutes), the pod
|
|
||||||
# stayed Running with restarts 0, and the log carried nothing but INFO batch
|
|
||||||
# lines and 404s at INFO level -- so every signal the cluster already had said
|
|
||||||
# "healthy". These two rules are built on the timestamps the exporter in
|
|
||||||
# apps/base/osint/analyst-exporter.yaml reads straight out of Postgres
|
|
||||||
# (SeriesMonitor osint-analyst-exporter, ns osint, :9187/metrics):
|
|
||||||
#
|
|
||||||
# osint_analyst_last_success_timestamp_seconds max(article_summaries.batch_timestamp)
|
|
||||||
# osint_ingest_last_article_timestamp_seconds max(articles.timestamp)
|
|
||||||
# osint_analyst_exporter_up 1 when the last DB read worked
|
|
||||||
#
|
|
||||||
# OsintAnalystStale is the general "no brief in over an hour" gate; the
|
|
||||||
# summarizer loops every 15 min, so an hour of silence cannot be a slow batch.
|
|
||||||
# OsintIngestAliveButNoBrief is the sharper one: a fresh article row plus a
|
|
||||||
# summary table frozen for two hours names the exact failure -- ingest fine,
|
|
||||||
# analyst dark -- without waiting for the read path or the API to be down.
|
|
||||||
#
|
|
||||||
# The absent() arm on OsintAnalystStale is deliberate: if the exporter, its
|
|
||||||
# ServiceMonitor or its scrape disappears, the series vanishes and "no data"
|
|
||||||
# would otherwise read as "no problem", which is the same invisible-failure
|
|
||||||
# shape this card exists to kill. Routes through the default Alertmanager
|
|
||||||
# receiver (Telegram @Siriusdevops_alert_bot).
|
|
||||||
apiVersion: monitoring.coreos.com/v1
|
|
||||||
kind: PrometheusRule
|
|
||||||
metadata:
|
|
||||||
name: osint-analyst
|
|
||||||
namespace: monitoring
|
|
||||||
labels:
|
|
||||||
release: kube-prometheus-stack
|
|
||||||
spec:
|
|
||||||
groups:
|
|
||||||
- name: osint-analyst
|
|
||||||
rules:
|
|
||||||
- alert: OsintAnalystStale
|
|
||||||
expr: |
|
|
||||||
(
|
|
||||||
time() - osint_analyst_last_success_timestamp_seconds > 3600
|
|
||||||
)
|
|
||||||
or
|
|
||||||
absent(osint_analyst_last_success_timestamp_seconds)
|
|
||||||
for: 30m
|
|
||||||
labels:
|
|
||||||
severity: warning
|
|
||||||
annotations:
|
|
||||||
summary: >-
|
|
||||||
osint analyst has written no brief for over an hour
|
|
||||||
description: >-
|
|
||||||
The newest article_summaries.batch_timestamp is more than an hour
|
|
||||||
old (the summarizer loops every 15 minutes), or the freshness
|
|
||||||
series is missing entirely. The container can still be Running
|
|
||||||
with restarts 0: a wedged analyst looks exactly like an idle one.
|
|
||||||
Check `kubectl -n osint logs deploy/osint-news-summarizer --tail=50`
|
|
||||||
for the interval rc, confirm the exporter target is UP in
|
|
||||||
Prometheus (job osint-analyst-exporter), and test the analyst
|
|
||||||
query directly:
|
|
||||||
`kubectl -n osint exec deploy/osint-db -- psql -U osint -d osint_data -c "select max(batch_timestamp), count(*) from article_summaries"`.
|
|
||||||
A silently dead model/API key is the usual cause.
|
|
||||||
- alert: OsintIngestAliveButNoBrief
|
|
||||||
expr: |
|
|
||||||
(
|
|
||||||
time() - osint_analyst_last_success_timestamp_seconds > 7200
|
|
||||||
)
|
|
||||||
and
|
|
||||||
(
|
|
||||||
time() - osint_ingest_last_article_timestamp_seconds < 7200
|
|
||||||
)
|
|
||||||
for: 10m
|
|
||||||
labels:
|
|
||||||
severity: warning
|
|
||||||
annotations:
|
|
||||||
summary: >-
|
|
||||||
osint scraper is ingesting but the analyst has written no brief for 2h
|
|
||||||
description: >-
|
|
||||||
`articles` has a row younger than two hours while
|
|
||||||
`article_summaries` has nothing newer than two hours. Ingest fine
|
|
||||||
+ analyst dark is the shape of the 2026-11-25..12-04 outage, where
|
|
||||||
the pipeline looked healthy for nine days because only the ingest
|
|
||||||
side was moving. Confirm the scraper is genuinely alive
|
|
||||||
(`kubectl -n osint logs deploy/osint-news-scraper --tail=20`) and
|
|
||||||
then debug the analyst side: summarizer logs, NEWS_SUMMARIZE_*
|
|
||||||
env, the resolved SUMMARY_MODEL and the Nous API key/inference
|
|
||||||
endpoint (a dead model or a 404 on every map call writes zero
|
|
||||||
rows while the loop keeps logging rc=0).
|
|
||||||
|
|
@ -1,139 +0,0 @@
|
||||||
# Rosenpass (post-quantum PSK rotation) -> Prometheus
|
|
||||||
#
|
|
||||||
# Link A (rpi wg0 10.10.0.1 <-> siriussec wg0 10.10.0.2) runs rosenpass 0.2.3
|
|
||||||
# as a host systemd unit on both ends, rotating that WireGuard peer's
|
|
||||||
# preshared key roughly every two minutes. Nothing about the *tunnel* depends
|
|
||||||
# on it working: WireGuard keeps using the last PSK it received, so a dead or
|
|
||||||
# stalled exchange leaves the link up and silently non-post-quantum. These two
|
|
||||||
# alerts are the only thing that notices.
|
|
||||||
#
|
|
||||||
# Why a host script and not a collector: the
|
|
||||||
# kube-prometheus-stack-prometheus-node-exporter DaemonSet is distroless and
|
|
||||||
# has no --collector.textfile.directory (only /host/proc, /host/sys and
|
|
||||||
# /host/root are mounted), while --collector.systemd needs dbus plumbing it
|
|
||||||
# does not have. So /usr/local/sbin/rosenpass-metrics.sh on rpi and siriussec
|
|
||||||
# (committed under infrastructure/networking/rosenpass/, driven by
|
|
||||||
# rosenpass-metrics.timer every 60 s) writes the textfile, and the
|
|
||||||
# prometheus-node-exporter block in values.yaml turns the collector on.
|
|
||||||
#
|
|
||||||
# Series, emitted per host, never containing key material (the PSK set is only
|
|
||||||
# SHA-256 hashed, in a root-only state file):
|
|
||||||
# rosenpass_unit_active{node="rpi|siriussec"} 0|1
|
|
||||||
# rosenpass_psk_rotation_age_seconds{node=...,interface="wg0|wg-remote"}
|
|
||||||
# rosenpass_psk_rotation_last_change_timestamp_seconds{node=...,interface="wg0|wg-remote"}
|
|
||||||
# rosenpass_upnp_mapping_present{node="rpi"} 0|1
|
|
||||||
# rosenpass_upnp_last_check_timestamp_seconds{node="rpi"}
|
|
||||||
#
|
|
||||||
# Both rotation rules carry an absent() arm deliberately: a metric that simply
|
|
||||||
# stops arriving (timer disabled, script broken, node-exporter down, scrape lost)
|
|
||||||
# must alert, because "nothing happened" is exactly what a healthy rotation
|
|
||||||
# looks like from Prometheus' side. The absent arms name the hosts and
|
|
||||||
# interfaces that actually run the timer — rpi wg0 + wg-remote (Link A + Link B),
|
|
||||||
# siriussec wg0 (Link A only; it has no wg-remote) — so linode, which has
|
|
||||||
# node-exporter but no rosenpass, and an interface absent from a host do not
|
|
||||||
# page.
|
|
||||||
#
|
|
||||||
# Link B's inbound path is a permanent UPnP mapping on the Pi's router (which
|
|
||||||
# has no accessible admin panel). rosenpass-upnp.sh re-asserts it every 15 min
|
|
||||||
# and stamps 1/0 into /run, which rosenpass-metrics.sh turns into the series
|
|
||||||
# below. Without that mapping the exchange cannot be dialled, the link keeps its
|
|
||||||
# last PSK and silently stops being post-quantum.
|
|
||||||
apiVersion: monitoring.coreos.com/v1
|
|
||||||
kind: PrometheusRule
|
|
||||||
metadata:
|
|
||||||
name: rosenpass
|
|
||||||
namespace: monitoring
|
|
||||||
labels:
|
|
||||||
release: kube-prometheus-stack
|
|
||||||
spec:
|
|
||||||
groups:
|
|
||||||
- name: rosenpass
|
|
||||||
rules:
|
|
||||||
- alert: RosenpassDown
|
|
||||||
expr: |
|
|
||||||
(
|
|
||||||
max by (node) (rosenpass_unit_active) == 0
|
|
||||||
)
|
|
||||||
or
|
|
||||||
(
|
|
||||||
absent(rosenpass_unit_active{node="rpi"})
|
|
||||||
or
|
|
||||||
absent(rosenpass_unit_active{node="siriussec"})
|
|
||||||
)
|
|
||||||
for: 5m
|
|
||||||
labels:
|
|
||||||
severity: warning
|
|
||||||
annotations:
|
|
||||||
summary: "Rosenpass is not active on {{ $labels.node }}"
|
|
||||||
description: >-
|
|
||||||
The unit on {{ $labels.node }} is not reporting active, or the
|
|
||||||
series is missing entirely (timer, script or scrape gone).
|
|
||||||
WireGuard on Link A keeps working on the last preshared key, so
|
|
||||||
traffic gives no hint — the tunnel has silently stopped being
|
|
||||||
post-quantum until this is fixed. On that host check
|
|
||||||
`systemctl status rosenpass` and
|
|
||||||
`systemctl list-timers rosenpass-metrics.timer`, then
|
|
||||||
`cat /var/lib/node-exporter/textfile/rosenpass.prom`. Do not
|
|
||||||
restart rosenpass on only one end: a one-sided restart leaves the
|
|
||||||
pair disagreeing until the next rekey.
|
|
||||||
- alert: RosenpassPskRotationStalled
|
|
||||||
expr: |
|
|
||||||
(
|
|
||||||
max by (node, interface) (rosenpass_psk_rotation_age_seconds) > 900
|
|
||||||
)
|
|
||||||
or
|
|
||||||
(
|
|
||||||
absent(rosenpass_psk_rotation_age_seconds{node="rpi", interface="wg0"})
|
|
||||||
or
|
|
||||||
absent(rosenpass_psk_rotation_age_seconds{node="rpi", interface="wg-remote"})
|
|
||||||
or
|
|
||||||
absent(rosenpass_psk_rotation_age_seconds{node="siriussec", interface="wg0"})
|
|
||||||
)
|
|
||||||
for: 10m
|
|
||||||
labels:
|
|
||||||
severity: warning
|
|
||||||
annotations:
|
|
||||||
summary: >-
|
|
||||||
No rosenpass PSK rotation on {{ $labels.node }} {{ $labels.interface }}
|
|
||||||
for over 15 minutes
|
|
||||||
description: >-
|
|
||||||
Rotation runs about every two minutes, so a preshared-key set that
|
|
||||||
has not changed in 15 minutes means the exchange has stalled
|
|
||||||
(peer unreachable, unit wedged) or the metric has gone missing.
|
|
||||||
The link still passes traffic on the last key, which is why this
|
|
||||||
is otherwise invisible. Check `systemctl status rosenpass` and
|
|
||||||
`journalctl -u rosenpass -n 30` on both rpi and siriussec, and
|
|
||||||
confirm the Pi still admits 9999/udp from 192.168.1.179
|
|
||||||
(`sudo ufw status | grep 9999`).
|
|
||||||
- alert: RosenpassUpnpMappingLost
|
|
||||||
expr: |
|
|
||||||
(
|
|
||||||
max by (node) (rosenpass_upnp_mapping_present) == 0
|
|
||||||
)
|
|
||||||
or
|
|
||||||
(
|
|
||||||
time() - max by (node) (rosenpass_upnp_last_check_timestamp_seconds) > 1800
|
|
||||||
)
|
|
||||||
or
|
|
||||||
absent(rosenpass_upnp_mapping_present{node="rpi"})
|
|
||||||
for: 10m
|
|
||||||
labels:
|
|
||||||
severity: warning
|
|
||||||
annotations:
|
|
||||||
summary: >-
|
|
||||||
Link B UPnP mapping missing or unverified on {{ $labels.node }}
|
|
||||||
description: >-
|
|
||||||
Link B (rpi wg-remote 10.20.0.2 <-> linode wg0 10.20.0.1) can only
|
|
||||||
be dialled inbound through a permanent UPnP mapping
|
|
||||||
UDP 9999 -> 192.168.1.125:9999 on the Pi's router, and
|
|
||||||
rosenpass-upnp.timer re-asserts it every 15 minutes. Either the
|
|
||||||
last run reported the mapping missing (value 0), no run has
|
|
||||||
updated the state for over 30 minutes (timer or router IGD gone),
|
|
||||||
or the series is absent entirely (state file cleared by a reboot,
|
|
||||||
metrics timer dead). The link keeps passing traffic on its last
|
|
||||||
preshared key, so this is invisible from the tunnel. On rpi check
|
|
||||||
`systemctl status rosenpass-upnp.timer`,
|
|
||||||
`journalctl -t rosenpass-upnp -n 20` and `upnpc -l | grep 9999`;
|
|
||||||
re-assert by hand with
|
|
||||||
`sudo systemctl start rosenpass-upnp.service`. If the router
|
|
||||||
rebooted, the mapping comes back on the next timer run.
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
data:
|
|
||||||
.dockerconfigjson: ENC[AES256_GCM,data:c7NwYAKS00RAzkEW3z1IA2XP24cdIJgQAaBjg7+WcsxLMEs2h42cg/fdtW6UYrrsQtq7X/T4wgfpzUjHq8aMI2lyiVhJa9vxHknpK32i2mP63YQ7o2axI2p5eGPQpB+uuLPr3e1A6I939co6LQCBrY1ueK9+9atCcSEflv/wJyXwrwvlV5EL20PTLTM/y8gGN9cXXfgk6aYV7F5mowQCcUIUDvCbj7cHIonumMfCANQgGjQHrACf0+2ko853nBwLQK1AtIP+U/NS1wDSbFmxqyO6OstF10Sq5t+8dY8baIt73RWN0BqB/7i08TsMpnNUXH4XJcP6WhP0FM+X3M5goJr80DNy2uG3fxTHwRSAeWGzIo2GuuK9qlMtIjjnU97K,iv:xPgSzx6+EEJRnTGYG+QZWJ7G3MUf6Ajd+CXpl8+XIxs=,tag:alsSmEFhXW46SeoVzdqyFA==,type:str]
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: forgejo-pull
|
|
||||||
namespace: monitoring
|
|
||||||
type: kubernetes.io/dockerconfigjson
|
|
||||||
sops:
|
|
||||||
age:
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA1eU8ydkR5SmF2UG9ZQWNY
|
|
||||||
TWdKTFJkdjFlWWtBSW4wdmFDWXA0akNSSFI4CmVpL3dMKy91b1JTUTRyV1QyRXlI
|
|
||||||
YnlQZVJhL0hNRENNdlM1cDZKZmRUN0kKLS0tIEZOVHBLOUsvbFp6VjJXbW1tVmhK
|
|
||||||
Y1M4a2VyL0Z2MDhLeGJZUCtHRnQ2cmMKU9Q4m7ZuZDYbNQgsvOXEAKBE1hW1pa7m
|
|
||||||
7/pmRAP43OjXfsjWUbnPmORcHSrVDtRrBxQZ2d1svVdwd6vMUPPjqw==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age12zdn7x72zrgu9cdv8wdj7xfx42nz09nrwpc2g09cwx5fwdm0ry6qp5h4jp
|
|
||||||
encrypted_regex: ^(data|stringData)$
|
|
||||||
lastmodified: "2026-12-04T05:16:30Z"
|
|
||||||
mac: ENC[AES256_GCM,data:yYt1AWNi+Ts4c/p3OwrknVVPMPf9PEeYvgz/LckFqsJweSq36b6gzinMcLxJGnenmCokftUA4RvMMF2f0Lcpo3+RqmpPGnCzpAVQ0ypuS2+n+bET7tF/tu9icuwZaTu0sNW+/j8VK5T5nlrrw+aLf3O9yIuP7XVLXyjodJqbH7c=,iv:jSMmP96DHN6qLmpHoisVQu1DYlMVehxdXNWkzh5GZwk=,tag:b98z963bBjpM5gGZnKHqBg==,type:str]
|
|
||||||
version: 3.13.3
|
|
||||||
|
|
@ -255,33 +255,6 @@ prometheus-node-exporter:
|
||||||
# to linode. node-exporter is a read-only host-metrics DaemonSet (hostPath
|
# to linode. node-exporter is a read-only host-metrics DaemonSet (hostPath
|
||||||
# /proc + /sys, host network); it adds ~700 series per node, well inside the
|
# /proc + /sys, host network); it adds ~700 series per node, well inside the
|
||||||
# 8GB retentionSize cap, and rpi's PreferNoSchedule taint does not exclude it.
|
# 8GB retentionSize cap, and rpi's PreferNoSchedule taint does not exclude it.
|
||||||
#
|
|
||||||
# Textfile collector: rosenpass-metrics.sh on rpi/siriussec writes
|
|
||||||
# /var/lib/node-exporter/textfile/rosenpass.prom and the DaemonSet serves it
|
|
||||||
# from /metrics (alerts: monitoring/controllers/home/rosenpass.yaml, host
|
|
||||||
# units: infrastructure/networking/rosenpass/). The image is distroless with
|
|
||||||
# no collector enabled, so the flag below is what turns it on.
|
|
||||||
#
|
|
||||||
# extraArgs REPLACES the subchart default list — Helm replaces lists, it does
|
|
||||||
# not merge them. The two filesystem exclusions are copied verbatim from
|
|
||||||
# prometheus-node-exporter 4.60.1 (the subchart pinned by kube-prometheus-stack
|
|
||||||
# 92.14.0); dropping them would add every container mountpoint to
|
|
||||||
# node_filesystem_* and change the disk alerts.
|
|
||||||
extraArgs:
|
|
||||||
- --collector.textfile.directory=/host/textfile
|
|
||||||
- --collector.filesystem.mount-points-exclude=^/(dev|proc|sys|run/containerd/.+|var/lib/docker/.+|var/lib/kubelet/.+)($|/)
|
|
||||||
- --collector.filesystem.fs-types-exclude=^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs|erofs)$
|
|
||||||
extraVolumes:
|
|
||||||
- name: textfile
|
|
||||||
hostPath:
|
|
||||||
path: /var/lib/node-exporter/textfile
|
|
||||||
# DirectoryOrCreate: nodes with no rosenpass timer (linode) still get a
|
|
||||||
# mountable empty directory instead of a CreateContainerConfigError.
|
|
||||||
type: DirectoryOrCreate
|
|
||||||
extraVolumeMounts:
|
|
||||||
- name: textfile
|
|
||||||
mountPath: /host/textfile
|
|
||||||
readOnly: true
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 20m
|
cpu: 20m
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue