From 4eeac3d33a37bd987c3a38553f31ef8a1d8e466c Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Mon, 2 Nov 2026 22:02:58 -0600 Subject: [PATCH] Route registry copy through Proxmox and prepare Orange Pi target --- bootstrap/apps/README.md | 12 ++++++++++++ bootstrap/cluster/main.tf | 4 ++++ homelab.yml | 21 +++++++++++++++++++++ scripts/registry-storage-reconcile.py | 21 +++++++++++++++++---- 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/bootstrap/apps/README.md b/bootstrap/apps/README.md index eddfb6b..1d487eb 100644 --- a/bootstrap/apps/README.md +++ b/bootstrap/apps/README.md @@ -62,6 +62,10 @@ Registry paths must be specific directories below `/data`. Migration requires passwordless sudo on the destination, source worker and Proxmox host. This is a copy, not ongoing replication or failover between registries. +Source reads and bulk transfer now pass through the configured Proxmox host. +An A/B test transferred 64 MiB successfully through that host while direct +worker-to-Debian SSH repeatedly failed MAC verification. Authentication remains +end-to-end and private keys stay on the deployment host. Bulk transfer uses a fresh, non-multiplexed SSH connection with AES-256-GCM, compression disabled and mandatory source/destination SHA-256 verification. `LAB_REGISTRY_TRANSFER_CIPHER` can select another supported authenticated cipher @@ -71,3 +75,11 @@ failure aborts transfer and never publishes partial storage. Repeated SSH MAC errors, especially alongside TLS bad-record-MAC failures, require investigation of the endpoints and network path; cipher selection alone does not prove that the underlying issue is repaired. + +The retained `k3s` profile targets the existing x86 Debian cluster at `.73`. +The prepared `opi5-k3s` profile targets the Orange Pi host at `.80` with separate +state, kubeconfig and enrollment. Its host currently runs Pimox: direct k3s +bootstrap refuses an active hypervisor, and this profile is not ready to deploy +until host OS preparation and registry placement for the new target are resolved. +Do not reinstall the hypervisor or erase its disks before securing registry and +other required VM data. diff --git a/bootstrap/cluster/main.tf b/bootstrap/cluster/main.tf index b0a31f9..4df7593 100644 --- a/bootstrap/cluster/main.tf +++ b/bootstrap/cluster/main.tf @@ -36,6 +36,10 @@ resource "null_resource" "k3s_control_plane" { provisioner "remote-exec" { inline = [</dev/null 2>&1 || sudo test -d /etc/pve; then + echo "This target is an active Proxmox/Pimox host. Prepare its Debian host OS before direct k3s installation; preserving VM disks and hypervisor networking." >&2 + exit 1 +fi if sudo test -s /etc/kubernetes/manifests/kube-apiserver.yaml || sudo test -s /etc/kubernetes/admin.conf; then echo "A kubeadm control plane is already present; refusing to install k3s over it." >&2 exit 1 diff --git a/homelab.yml b/homelab.yml index 18f30a3..ceb2f18 100644 --- a/homelab.yml +++ b/homelab.yml @@ -88,6 +88,7 @@ cluster: control_plane_vmid: 9001 worker_count: 2 worker_static_ips: 192.168.100.66 192.168.100.67 + # Existing x86 cluster remains available with its pinned identity/state. k3s: control_plane: node_name: debian @@ -108,6 +109,26 @@ cluster: platform: calico_operator_node_name: debian runtime: k3s + opi5-k3s: + control_plane: + node_name: opi5plus + lan_ip: 192.168.100.80 + user: jv + ssh_key_path: /home/jv/.ssh/id_ed25519 + kubeconfig: /home/jv/.kube/opi5-k3s-config + kubeconfig_owner: jv:jv + registry: + endpoint: 192.168.100.73:30500 + provisioning: + host: 192.168.100.73 + user: jv + http: + host: 192.168.100.80 + gitops: + repo_url: ssh://git@192.168.100.73:32222/jv/my-homelab-configs.git + platform: + calico_operator_node_name: opi5plus + runtime: k3s hosts: debian: diff --git a/scripts/registry-storage-reconcile.py b/scripts/registry-storage-reconcile.py index 5184ee9..ebb97da 100644 --- a/scripts/registry-storage-reconcile.py +++ b/scripts/registry-storage-reconcile.py @@ -35,6 +35,19 @@ def ssh(host, user, key, command, cipher=None): return [*options, f"{user}@{host}", command] +def registry_source_ssh(args, command, cipher=None): + target = ssh(args.source_host, args.source_user, args.source_key, command, cipher=cipher) + # Bulk A/B tests verified this path while direct worker LAN traffic + # failed SSH integrity checks. Proxy SSH uses the destination host's key; + # no private key or registry credentials are copied to the hypervisor. + proxy = ["ssh", "-T", "-i", args.hypervisor_key, "-o", "BatchMode=yes", + "-o", "IdentitiesOnly=yes", "-o", "ConnectTimeout=10", + "-o", "StrictHostKeyChecking=accept-new", "-o", "ControlPath=none", + "-c", "aes256-gcm@openssh.com", "-W", "%h:%p", + f"{args.hypervisor_user}@{args.hypervisor_host}"] + return [*target[:-2], "-o", "ProxyCommand=" + shlex.join(proxy), *target[-2:]] + + def main(): parser = argparse.ArgumentParser(description=__doc__) for name in ("kubeconfig", "destination-node", "destination-path", "source-host", @@ -119,7 +132,7 @@ def resolve_registry_links(args, conflicts, source_files, destination_files): verified = set() def source_read(relative): - return run(ssh(args.source_host, args.source_user, args.source_key, + return run(registry_source_ssh(args, "sudo -n cat -- " + shlex.quote(str(Path(args.source_path) / relative))), timeout=60) def verify_digest(digest, expand_manifest=False, depth=0): @@ -206,7 +219,7 @@ def prepare_local(args, path, existing_pv): destination_manifest = local_manifest(path) if exists else "" destination_files = manifest_files(destination_manifest) - source_ssh = lambda command: ssh(args.source_host, args.source_user, args.source_key, command) + source_ssh = lambda command: registry_source_ssh(args, command) hyper_ssh = lambda command: ssh(args.hypervisor_host, args.hypervisor_user, args.hypervisor_key, command) started = False stage = None @@ -267,7 +280,7 @@ def prepare_local(args, path, existing_pv): special = run(source_ssh("sudo -n find " + shlex.quote(args.source_path) + " -mindepth 1 ! -type f ! -type d -print -quit")) if special: raise RuntimeError("Source registry contains non-regular files; refusing unsafe archive extraction") - print(f"Copying registry data from {args.source_host}:{args.source_path} into staging storage using {args.transfer_cipher}", flush=True) + print(f"Copying registry data from {args.source_host}:{args.source_path} through {args.hypervisor_host} using {args.transfer_cipher}", flush=True) diagnostics = state / "diagnostics" diagnostics.mkdir(parents=True, exist_ok=True, mode=0o700) transfer_id = str(time.time_ns()) @@ -276,7 +289,7 @@ def prepare_local(args, path, existing_pv): with source_log.open("w+b") as source_errors, destination_log.open("w+b") as destination_errors: source_log.chmod(0o600) destination_log.chmod(0o600) - source_command = ssh(args.source_host, args.source_user, args.source_key, + source_command = registry_source_ssh(args, "sudo -n tar -C " + shlex.quote(args.source_path) + " -cpf - .", cipher=args.transfer_cipher) source = subprocess.Popen(source_command, stdout=subprocess.PIPE, stderr=source_errors)