Homelab · Infrastructure wiki

Stretching VLAN 800 to Oracle Cloud

How the k3s node VLAN (172.20.0.0/24) was extended from the Alta Labs Route10 at home to an OCI arm64 VM, using VXLAN inside WireGuard, and how four Alpine Incus containers on that VM became cluster nodes on the same subnet as the Raspberry Pis.

Built 30 Nov 2026 Remote nodes 4 × Incus/Alpine 3.24 Host Debian 13 · 7.3.4 cloud Tunnel WG + VXLAN VNI 800 L2 MTU 1370 RTT home↔OCI ~26 ms

1Overview

The Pis and the cloud containers share one broadcast domain. Nothing is routed between the sites: Ethernet frames for VLAN 800 are wrapped in VXLAN, the VXLAN packets travel inside a WireGuard tunnel, and each end drops them into a Linux bridge. To Kubernetes, Cilium and DHCP, the OCI containers look like four more machines plugged into the home switch.

At a glance

Home end
Route10
br-lan_800 · 172.20.0.1 · OpenWrt 21.02
Cloud end
OCI VM
149.130.223.219 · Debian 13 arm64 · 2 vCPU / 11 GiB
Underlay
WireGuard
wg-oci 10.255.80.1 ↔ .2 · UDP 51820
Overlay
VXLAN VNI 800
vx800 · UDP 4789 · point-to-point
Remote nodes
k8s-oci-30…33
172.20.0.30–.33 · 2 GiB each
Host on VLAN
172.20.0.29
br800 · port-forward gateway

Topology

HOME · VLAN 800 · 172.20.0.0/24 OCI VM · 149.130.223.219 8 × Raspberry Pi 5 172.20.0.21 – .28 3 servers (etcd) + 5 agents LoadBalancer IPs .100 – .254 · ARP by Pis Your Mac / LAN 192.168.0.0/23 → routed Route10 192.168.1.254 · fw3 br-lan_800 172.20.0.1/24 vx800 VNI 800 · 1370 wg-oci 10.255.80.1/30 WireGuard · UDP 51820 keepalive 25 s · ~26 ms Route10 dials out no home port forward enp0s6 (public) 10.0.0.222 · DNAT br800 172.20.0.29 · 1370 vx800 VNI 800 · 1370 wg-oci 10.255.80.2/30 k8s-oci-30172.20.0.30 · 2 GiB k8s-oci-31172.20.0.31 · 2 GiB k8s-oci-32172.20.0.32 · 2 GiB k8s-oci-33172.20.0.33 · 2 GiB
Green lines are VLAN 800 Ethernet, the thick blue line is the WireGuard underlay. The VXLAN devices (violet) are bridge ports on both ends. On the OCI side, public port forwards enter on enp0s6 and are DNAT'd into br800 (dashed amber).

Addressing plan

AddressWhatWhere
172.20.0.1/24VLAN 800 gateway, DHCP, DNSRoute10 br-lan_800
172.20.0.21–.28Raspberry Pi nodeshome
172.20.0.29OCI host on VLAN 800 (MAC 02:00:00:80:00:29)OCI br800
172.20.0.30–.33Incus k8s nodes (MAC 00:16:3e:80:00:30–33)OCI containers
172.20.0.100–.254Cilium LB-IPAM pool lanannounced on L2
10.255.80.1/30 · .2/30WireGuard transit / VXLAN endpointsRoute10 · OCI
149.130.223.219:51820/udpWireGuard listenerOCI public IP

2Tunnel design

Why VXLAN in WireGuard

WireGuard only carries IP packets, so on its own it can route a subnet but cannot put remote machines on it. VXLAN carries whole Ethernet frames over UDP, but has no encryption or NAT traversal. Stacking them gives an encrypted L2 segment:

  • WireGuard is a /30 only. AllowedIPs is just the peer's transit address; VLAN 800 itself is never routed over it, so no routing table on either side changes.
  • VXLAN is unicast point-to-point between 10.255.80.1 and .2 (remote set on both ends, no multicast). Broadcast and unknown-unicast flood across it; MAC learning keeps the rest efficient.
  • The Route10 dials out to OCI with a 25 s keepalive. The home WAN needs no port forward, and a changed home IP is picked up by WireGuard roaming automatically. The OCI Security List allows UDP 51820 inbound.

MTU

LayerMTUWhy
Internet path1500public Internet
wg-oci14201500 − 80 (WireGuard over IPv4/IPv6 worst case)
vx800, br800, container eth013701420 − 50 (outer IP 20 + UDP 8 + VXLAN 8 + inner Ethernet 14)
A bridge cannot fragment

Frames larger than 1370 bytes are silently dropped at vx800. Every node on VLAN 800 therefore runs MTU 1370 (cluster-wide mtu setting in the netboot-ctl dashboard), and the CNI MTU sits below that. Verified end to end with a 1342-byte DF ping (1370 on the wire) from the OCI side to 172.20.0.1.

3Route10 side

What the router is

FactConsequence
OpenWrt 21.02.1, kernel 5.4, aarch64, 1 GB RAMKernel has vxlan and wireguard; ip, bridge, wg are full versions. Verified by creating throwaway interfaces.
One Linux bridge per VLAN (br-lan_800, vlan_filtering 0)vx800 is simply enslaved; no VLAN tagging needed on the VXLAN port.
fw3 / iptables with INPUT and OUTPUT policy DROPExplicit accepts for VXLAN + ICMP in, and everything out of wg-oci. fw3 only flushes rules tagged !fw3, so ours survive reloads.
Existing UI WireGuard server on wg (192.168.100.0/24, port 53551)Untouched. The tunnel uses a separate interface wg-oci.
/etc/config/* is regenerated from the Alta cloud controllerHand-edited UCI does not persist. Everything lives in /cfg.

Surviving reboots

/cfg is a persistent partition (it survives reboots and firmware upgrades). Alta's config daemon /usr/sbin/black runs /cfg/post-cfg.sh after every config apply, right after /etc/init.d/firewall reload; this was confirmed from the binary's strings. A config apply also happens at boot. The hook starts the tunnel script in the background, and the script waits up to 60 s for br-lan_800 to exist.

#!/bin/sh
# /cfg/post-cfg.sh — Route10 runs this after boot and after every config apply.
# If you already have a post-cfg.sh, just append the line below to it.
( /cfg/vxlan-oci.sh >/tmp/vxlan-oci.log 2>&1 & )
Not yet proven by a reboot

The router has not been rebooted since the tunnel was installed. After the next reboot, check that wg show wg-oci shows a recent handshake.

/cfg/vxlan-oci.sh

Idempotent. It is safe on every boot and every config push. The router's private key is in /cfg/wg-oci.key (mode 600) and never left the router.

#!/bin/sh
# Extend VLAN 800 to an OCI VM: WireGuard (underlay) + VXLAN (L2) bridged into VLAN 800.
# Idempotent: safe to run on every boot and every config push (called from /cfg/post-cfg.sh).
# Install to: /cfg/vxlan-oci.sh   (chmod +x)

# ---------- EDIT THESE ----------
OCI_PUBLIC_IP="149.130.223.219"       # OCI VM public IP
OCI_WG_PORT="51820"
OCI_WG_PUBKEY="eLEPkiICUUyOkmRBOT484bycC/U+Jbwv3h7lbThUchw="
WG_KEY_FILE="/cfg/wg-oci.key"         # router private key (create once, see README)
WG_IF="wg-oci"
WG_LOCAL="10.255.80.1"                # /30 transit, only used as VXLAN endpoints
WG_REMOTE="10.255.80.2"
WG_MTU="1420"

VX_IF="vx800"
VNI="800"
VX_PORT="4789"
VX_MTU="1370"                         # 1420 (wg) - 50 (vxlan/udp/ip)

VLAN_BRIDGE="br-lan_800"              # Route10 per-VLAN bridge (172.20.0.1/24)
VLAN_ID="800"                         # only used if VLAN_BRIDGE is vlan-aware
# --------------------------------

log() { logger -t vxlan-oci "$*"; echo "vxlan-oci: $*"; }

# Wait for the bridge to exist (post-cfg can fire before networking is fully up)
i=0; while ! ip link show "$VLAN_BRIDGE" >/dev/null 2>&1; do
  i=$((i+1)); [ $i -gt 60 ] && { log "bridge $VLAN_BRIDGE not found, abort"; exit 1; }; sleep 1
done

modprobe wireguard 2>/dev/null; modprobe vxlan 2>/dev/null

# ---- WireGuard ----
ip link show "$WG_IF" >/dev/null 2>&1 || ip link add "$WG_IF" type wireguard
wg set "$WG_IF" private-key "$WG_KEY_FILE" \
  peer "$OCI_WG_PUBKEY" endpoint "$OCI_PUBLIC_IP:$OCI_WG_PORT" \
  allowed-ips "$WG_REMOTE/32" persistent-keepalive 25
ip addr replace "$WG_LOCAL/30" dev "$WG_IF"
ip link set "$WG_IF" mtu "$WG_MTU" up

# ---- VXLAN ----
if ! ip link show "$VX_IF" >/dev/null 2>&1; then
  ip link add "$VX_IF" type vxlan id "$VNI" local "$WG_LOCAL" remote "$WG_REMOTE" \
    dstport "$VX_PORT" dev "$WG_IF"
fi
ip link set "$VX_IF" mtu "$VX_MTU" master "$VLAN_BRIDGE" up

# If the bridge is VLAN-aware (one bridge, many VLANs), map the vxlan port to VLAN 800 untagged
if [ "$(cat /sys/class/net/$VLAN_BRIDGE/bridge/vlan_filtering 2>/dev/null)" = "1" ]; then
  bridge vlan del dev "$VX_IF" vid 1 2>/dev/null
  bridge vlan add dev "$VX_IF" vid "$VLAN_ID" pvid untagged
fi

# ---- Firewall: INPUT policy is DROP (fw3). fw3 only flushes rules tagged "!fw3", so this survives
# reloads; post-cfg.sh re-runs us after every reload anyway. ----
iptables -C INPUT -i "$WG_IF" -p udp --dport "$VX_PORT" -m comment --comment vxlan-oci -j ACCEPT 2>/dev/null || \
  iptables -I INPUT -i "$WG_IF" -p udp --dport "$VX_PORT" -m comment --comment vxlan-oci -j ACCEPT
iptables -C INPUT -i "$WG_IF" -p icmp -m comment --comment vxlan-oci -j ACCEPT 2>/dev/null || \
  iptables -I INPUT -i "$WG_IF" -p icmp -m comment --comment vxlan-oci -j ACCEPT
# OUTPUT policy is also DROP; the tunnel only reaches 10.255.80.2, so allow everything out of it
iptables -C OUTPUT -o "$WG_IF" -m comment --comment vxlan-oci -j ACCEPT 2>/dev/null || \
  iptables -I OUTPUT -o "$WG_IF" -m comment --comment vxlan-oci -j ACCEPT

log "up: $WG_IF -> $OCI_PUBLIC_IP, $VX_IF (vni $VNI) in $VLAN_BRIDGE"

4OCI VM

ItemValue
Instanceoci-rr, Ampere arm64, 2 vCPU, 11 GiB RAM, 200 GB btrfs root (@rootfs subvolume)
OSDebian 13 (trixie), kernel 7.3.4+deb13-cloud-arm64 from trixie-backports
Network managementifupdown (/etc/network/interfaces), DHCP on enp0s6
Adminwiredboy (sudo, member of incus-admin)
Installed for thiswireguard-tools, incus 6.0.4 (Debian), lxcfs, tcpdump, ethtool

Network config

The VM already used ifupdown, so the tunnel is configured there too. systemd-networkd was considered but avoided. Started next to ifupdown, it can remove routes it did not create (ManageForeignRoutes). Interfaces come up in file order: WireGuard, then the bridge, then VXLAN as a bridge port.

/etc/network/interfaces.d/vlan800

# VLAN 800 extension: WireGuard underlay -> VXLAN (VNI 800) -> br800 (LXC containers attach here)

auto wg-oci
iface wg-oci inet static
    address 10.255.80.2/30
    mtu 1420
    pre-up ip link add wg-oci type wireguard
    pre-up wg setconf wg-oci /etc/wireguard/wg-oci.conf
    pre-up wg set wg-oci private-key /etc/wireguard/wg-oci.key
    post-down ip link del wg-oci

auto br800
iface br800 inet manual
    # fixed MAC so LAN ARP caches / DHCP reservations stay valid as containers come and go
    pre-up ip link add br800 address 02:00:00:80:00:29 type bridge stp_state 0
    pre-up ip link set br800 mtu 1370
    up ip link set br800 up
    # host's own address on VLAN 800 (no gateway: host keeps its default route via enp0s6)
    post-up ip addr replace 172.20.0.29/24 dev br800
    # ip_forward, port forwards (/etc/vlan800/forwards), SNAT for replies, FORWARD filtering
    post-up /usr/local/sbin/vlan800-forwards
    post-down ip link del br800

auto vx800
iface vx800 inet manual
    pre-up ip link add vx800 type vxlan id 800 local 10.255.80.2 remote 10.255.80.1 dstport 4789 dev wg-oci
    pre-up ip link set vx800 mtu 1370 master br800
    up ip link set vx800 up
    post-down ip link del vx800

/etc/wireguard/wg-oci.conf

In wg setconf format. The private key is in /etc/wireguard/wg-oci.key, mode 600, and never left the VM.

# wg setconf format (no Address/MTU here; ifupdown sets those). Private key lives in wg-oci.key.
[Interface]
ListenPort = 51820

[Peer]
# Route10 (dials in with keepalive; no Endpoint needed here)
PublicKey = uvU1Zm+YwiNehkq8fhtoVX9S4SsCqEjKInQEmC3w4Eo=
AllowedIPs = 10.255.80.1/32

/etc/modules-load.d/k8s-lxc.conf

wireguard
vxlan
overlay
br_netfilter
ip_vs
ip_vs_rr
ip_vs_wrr
ip_vs_sh
nf_conntrack

/etc/sysctl.d/90-k8s-lxc.conf

net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
fs.inotify.max_user_instances = 8192
fs.inotify.max_user_watches = 1048576
kernel.keys.maxkeys = 2000
vm.overcommit_memory = 1
kernel.panic = 10
kernel.panic_on_oops = 1

The containers share the host kernel, so kernel modules and sysctls for Kubernetes and Cilium have to be set on the host.

Kernel 7.3

  1. Installed linux-image-cloud-arm64 from trixie-backports, which gave 7.3.4-1~bpo13+1. The meta package now tracks backports, so future 7.x updates arrive with apt upgrade.
  2. Checked before rebooting that 7.3 includes every module in use: wireguard, vxlan, bridge, br_netfilter, overlay, ip_vs*, nf_conntrack, nf_nat, veth and fuse.
  3. Set GRUB to boot 7.3 once (grub-reboot) with 6.12 as the saved default, then rebooted. The VM was back in about 36 s. The tunnel, lxcfs, Incus and all containers came back, and the k3s nodes reported Ready on 7.3.4.
  4. Set GRUB_DEFAULT=0 (newest kernel) again and removed all 6.12 kernels (.111 residue, .115, .118).
grub-reboot does not work on this VM

The root filesystem is btrfs, and GRUB cannot write grubenv there at boot, so a one-time next_entry is never cleared. Use the GRUB menu on the OCI serial console (5 s timeout) to boot another kernel. Only 7.3.4 is installed right now; apt keeps the previous version after the next kernel update.

Docker removal

The VM previously ran Docker (Coolify, n8n and Twenty CRM, with no containers left running). Since it was no longer needed, it was removed completely:

  • Purged all docker-ce, containerd.io and plugin packages, the Docker apt repo and the docker group.
  • Deleted /var/lib/docker and /var/lib/containerd (including 6 volumes), /opt/containerd, /data/coolify and the apt cache.
  • Deleted Docker's bridges, iptables chains and NAT rules. One rule masqueraded 10.0.0.0/24, because docker0 overlapped the VCN subnet of enp0s6.
  • Removed Coolify's SSH key from /root/.ssh/authorized_keys. It would otherwise still have allowed root logins from a Coolify server.

5Host access & port forwards

Host address 172.20.0.29

At first br800 had no IP address: the host only switched frames and could not reach the containers itself. It now has 172.20.0.29/24 with no gateway, so its default route stays on enp0s6. It also has a fixed MAC (02:00:00:80:00:29). Otherwise a Linux bridge takes the lowest port MAC, which changes as containers start and stop, and the LAN's ARP caches would keep going stale.

Port forwards

Public forwards are listed in /etc/vlan800/forwards, one per line: <tcp|udp> <public port> <ip>:<port>. Apply them with sudo vlan800-forwards; the script also runs on every br800 up. Each public port must also be opened in the OCI Security List or NSG.

Why forwarded connections are masqueraded

The containers' default gateway is the Route10. Without SNAT, a reply to an Internet client would leave through the home WAN, and the connection would break because the routing is asymmetric. Masquerading only DNAT'd connections into br800 makes services see 172.20.0.29 as the client, and replies return through OCI. If a service needs the real client IP, forward to a LoadBalancer IP that is announced from a remote node and use proxy protocol, or terminate TLS on the host.

#!/bin/sh
# Applies /etc/vlan800/forwards + routing/NAT plumbing between the OCI host and VLAN 800. Idempotent.
set -e
CONF=/etc/vlan800/forwards
WAN=$(ip -4 route show default | awk '{print $5; exit}')   # enp0s6
BR=br800

ipt() { iptables "$@"; }
chain() { ipt -t "$1" -N "$2" 2>/dev/null || ipt -t "$1" -F "$2"; }   # create or flush
hook()  { ipt -t "$1" -C "$2" $3 -j "$4" 2>/dev/null || ipt -t "$1" -I "$2" $3 -j "$4"; }

sysctl -qw net.ipv4.ip_forward=1

# DNAT rules from the forwards file
chain nat VLAN800-DNAT
hook  nat PREROUTING "-i $WAN" VLAN800-DNAT
n=0
grep -vE '^\s*(#|$)' "$CONF" 2>/dev/null | while read -r proto port dest; do
  ipt -t nat -A VLAN800-DNAT -p "$proto" --dport "$port" -j DNAT --to-destination "$dest"
done

# Replies must come back through this host, not via the containers' gateway (Route10):
# masquerade only DNAT'd connections going into VLAN 800, so containers see 172.20.0.29 as client.
chain nat VLAN800-SNAT
ipt -t nat -A VLAN800-SNAT -o $BR -m conntrack --ctstate DNAT -j MASQUERADE
hook  nat POSTROUTING "" VLAN800-SNAT

# FORWARD: L2 switching on br800, forwarded ports and their replies. Nothing else is routed
# between the OCI VCN and VLAN 800.
chain filter VLAN800-FWD
ipt -A VLAN800-FWD -i $BR -o $BR -j ACCEPT
ipt -A VLAN800-FWD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
ipt -A VLAN800-FWD -i "$WAN" -o $BR -m conntrack --ctstate DNAT -j ACCEPT
hook  filter FORWARD "" VLAN800-FWD
ipt -D FORWARD -i $BR -o $BR -j ACCEPT 2>/dev/null || true   # superseded by VLAN800-FWD
ipt -P FORWARD DROP

echo "vlan800-forwards: $(ipt -t nat -S VLAN800-DNAT | grep -c -- "-j DNAT") forward(s) active"

The FORWARD policy is DROP. The host only passes switched br800 traffic, DNAT'd forwards and their replies. It does not act as a router between the OCI VCN and the home VLAN.

Cilium host firewall

The nodes run a Cilium host firewall (CiliumClusterwideNetworkPolicy host-firewall, managed from the dashboard under Admin > Firewall). After .29 was added, ICMP from the host passed but TCP was dropped. In a capture the SYN reached the container's eth0 and no SYN-ACK came back. Turning off TX checksum offload was tested and ruled out.

  - fromCIDR:
    - 172.20.0.29/32        # OCI host: host→node access and all port-forwarded traffic

Once this rule was added, TCP 22 and 10250 on the nodes became reachable from the host. If a forward targets pods, for example through a LoadBalancer IP, the pods' own network policies must also allow 172.20.0.29/32.

Public HTTPS (Caddy)

Public sites go through Caddy, which runs in the cluster on the OCI nodes. The OCI host only forwards ports 80 and 443. Caddy proxies to services by their cluster names, which work only inside the cluster: the host cannot reach ClusterIPs (10.43.0.0/16).

internet ─► 149.130.223.219:80/443 ─(vlan800-forwards DNAT + masquerade)─► 172.20.0.100 ─► Caddy pod (k8s-oci-*)
                                                             └─► <svc>.<ns>.svc.cluster.local
SiteBackend
vlandoc.9216635.xyzvlan800-docs.docs.svc.cluster.local:80
goldpinger.9216635.xyzgoldpinger.goldpinger.svc.cluster.local:8080
  • Announcing .100: the Service has externalTrafficPolicy: Local and the label netboot.lab/announce-remote, so only an OCI node that runs a Caddy pod answers ARP for .100. Traffic never crosses the tunnel.
  • TLS: Let's Encrypt only (acme_ca; Caddy would otherwise fall back to ZeroSSL). Certificates live in the host's /srv/k8s-shared/caddy, mounted into every node as /srv/caddy by the Incus profile device caddy-data and into the pods with hostPath. Both replicas share it, which is how Caddy coordinates ACME.
  • Ports: Caddy listens on 8080 and 8443 as nobody, and the Service maps 80 and 443 to them. Because automatic redirects would point at :8443, the http:// block redirects explicitly.
  • Image: caddy/Dockerfile is the official image with setcap -r. The stock binary carries cap_net_bind_service, and with all capabilities dropped and allowPrivilegeEscalation: false the kernel refuses to exec it (exec /usr/bin/caddy: operation not permitted).
  • Client IP: backends and Caddy see 172.20.0.29, because the host masquerades the connections.
  • Add a site: edit the Caddyfile in caddy/k8s.yaml, bump caddyfile/rev, kubectl apply -f caddy/k8s.yaml, and point the public DNS name at 149.130.223.219.
# Public reverse proxy: internet -> OCI 149.130.223.219:80/443 -> (vlan800-forwards DNAT) -> 172.20.0.100 -> Caddy
# Caddy runs on the OCI nodes and proxies to services by their cluster FQDN.
# TLS: Let's Encrypt (HTTP-01 / TLS-ALPN). Cert storage is /srv/caddy on the nodes = the OCI host's
# /srv/k8s-shared/caddy (Incus profile device "caddy-data"), shared by all replicas so they coordinate ACME.
apiVersion: v1
kind: Namespace
metadata:
  name: caddy
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: caddy
  namespace: caddy
data:
  Caddyfile: |
    {
        email ramonluis@gmail.com
        # Let's Encrypt only (Caddy otherwise falls back to ZeroSSL)
        acme_ca https://acme-v02.api.letsencrypt.org/directory
        # unprivileged ports inside the pod; the Service maps 80/443 to them
        http_port 8080
        https_port 8443
        # automatic redirects would point at :8443, so redirect explicitly below
        auto_https disable_redirects
        storage file_system /data
        servers {
            protocols h1 h2
        }
    }

    http:// {
        redir https://{host}{uri} 308
    }

    vlandoc.9216635.xyz {
        reverse_proxy vlan800-docs.docs.svc.cluster.local:80
    }

    goldpinger.9216635.xyz {
        reverse_proxy goldpinger.goldpinger.svc.cluster.local:8080
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: caddy
  namespace: caddy
spec:
  replicas: 2
  selector:
    matchLabels: {app: caddy}
  template:
    metadata:
      labels: {app: caddy}
      annotations:
        # bump to roll the pods after editing the Caddyfile (or: kubectl -n caddy rollout restart deploy/caddy)
        caddyfile/rev: "2"
    spec:
      nodeSelector:
        netboot.lab/remote: "true"
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: kubernetes.io/hostname
          whenUnsatisfiable: DoNotSchedule
          labelSelector:
            matchLabels: {app: caddy}
      securityContext:
        runAsNonRoot: true
        runAsUser: 65534
        runAsGroup: 65534
        seccompProfile: {type: RuntimeDefault}
      containers:
        - name: caddy
          # official caddy:2.10.2-alpine minus the file capability (see caddy/Dockerfile)
          image: 192.168.0.4:8080/2bleere/caddy:2.10.2-nocap
          args: [caddy, run, --config, /etc/caddy/Caddyfile, --adapter, caddyfile]
          env:
            - {name: XDG_DATA_HOME, value: /data}
            - {name: XDG_CONFIG_HOME, value: /config}
          ports:
            - {name: http, containerPort: 8080}
            - {name: https, containerPort: 8443}
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities: {drop: [ALL]}
          resources:
            requests: {cpu: 20m, memory: 32Mi}
            limits: {memory: 128Mi}
          readinessProbe:
            tcpSocket: {port: http}
            periodSeconds: 10
          livenessProbe:
            tcpSocket: {port: http}
            periodSeconds: 20
          volumeMounts:
            - {name: caddyfile, mountPath: /etc/caddy, readOnly: true}
            - {name: data, mountPath: /data}
            - {name: config, mountPath: /config}
      volumes:
        - name: caddyfile
          configMap: {name: caddy}
        - name: data
          hostPath: {path: /srv/caddy, type: Directory}
        - name: config
          emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: caddy
  namespace: caddy
  labels:
    netboot.lab/announce-remote: "true"
  annotations:
    lbipam.cilium.io/ips: "172.20.0.100"
spec:
  type: LoadBalancer
  # Local: only nodes running a Caddy pod (OCI nodes) announce .100, so traffic never crosses the tunnel
  externalTrafficPolicy: Local
  selector: {app: caddy}
  ports:
    - {name: http, port: 80, targetPort: http, protocol: TCP}
    - {name: https, port: 443, targetPort: https, protocol: TCP}

6Incus k8s nodes

The four nodes

ContainerIPMACRAMRole
k8s-oci-30172.20.0.3000:16:3e:80:00:302 GiBagent remote
k8s-oci-31172.20.0.3100:16:3e:80:00:312 GiBagent remote
k8s-oci-32172.20.0.3200:16:3e:80:00:322 GiBagent remote
k8s-oci-33172.20.0.3300:16:3e:80:00:332 GiBagent remote

All four run Alpine 3.24 (images:alpine/3.24, arm64, matching the Pis), with static IPs, gateway and DNS 172.20.0.1, boot.autostart=true, and storage pool default (dir driver). Each has the user 2bleere with the user@host ed25519 key and passwordless sudo. SSH accepts keys only and root login is disabled: ssh user@host works straight from the LAN. The nodes joined k3s as agents labelled netboot.lab/remote=true.

Profile k8s-node

Privileged and nested, unconfined AppArmor, all devices and capabilities, /dev/kmsg bind-mounted, the host kernel modules listed, and the NIC bridged to br800 at MTU 1370. This is what kubelet, containerd and Cilium need inside LXC. The trade-off: root inside a container is effectively root on the host.

config:
  limits.memory: 2GiB
  linux.kernel_modules: overlay,br_netfilter,ip_tables,ip6_tables,nf_nat,xt_conntrack,ip_vs,ip_vs_rr,ip_vs_wrr,ip_vs_sh,nf_conntrack,vxlan,xt_TPROXY,xt_socket,xt_mark,xt_comment,xt_CT,nft_compat,sch_fq,tcp_bbr,iscsi_tcp,openvswitch,nfs,nfsv4,dm_crypt
  raw.lxc: |
    lxc.apparmor.profile=unconfined
    lxc.cap.drop=
    lxc.cgroup2.devices.allow=a
    lxc.mount.auto=proc:rw sys:rw cgroup:rw
    lxc.mount.entry=/dev/kmsg dev/kmsg none defaults,bind,create=file
  security.nesting: "true"
  security.privileged: "true"
description: Privileged k8s node on VLAN 800 (br800, MTU 1370)
devices:
  caddy-data:
    path: /srv/caddy
    source: /srv/k8s-shared/caddy
    type: disk
  eth0:
    mtu: "1370"
    name: eth0
    nictype: bridged
    parent: br800
    type: nic
name: k8s-node

create-nodes.sh

Idempotent. It only creates what is missing and re-applies network, user and SSH settings. To add a node, extend the for n in … list and run sudo sh ~/vlan800/create-nodes.sh on the VM. Inside each container, /etc/local.d/rshared.start makes / a shared mount at boot, which kubelet requires for mount propagation.

#!/bin/sh
# Creates Alpine k8s node containers on br800 with static VLAN 800 IPs. Idempotent. Run with sudo.
set -e
IMAGE=images:alpine/3.24
ADMIN=2bleere
GW=172.20.0.1; DNS=172.20.0.1; DOMAIN=k8s.9216635.xyz
incus profile show k8s-node >/dev/null 2>&1 || incus profile create k8s-node
incus profile edit k8s-node < "$(dirname "$0")/k8s-node-profile.yaml"

for n in 30 31 32 33; do
  name=k8s-oci-$n; ip=172.20.0.$n; mac=00:16:3e:80:00:$n
  if ! incus info $name >/dev/null 2>&1; then
    incus init $IMAGE $name -p default -p k8s-node
    incus config device override $name eth0 hwaddr=$mac
    incus config set $name boot.autostart=true
  fi
  incus start $name 2>/dev/null || true
  incus exec $name -- sh -c "cat > /etc/network/interfaces <<IF
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address $ip/24
    gateway $GW
    mtu 1370
IF
printf 'search $DOMAIN\nnameserver $DNS\n' > /etc/resolv.conf
echo $name > /etc/hostname; hostname $name
# kubelet/k3s need shared mount propagation inside LXC
mkdir -p /etc/local.d
printf '#!/bin/sh\nmount --make-rshared /\n' > /etc/local.d/rshared.start; chmod +x /etc/local.d/rshared.start
rc-update add local default >/dev/null 2>&1
rc-service networking restart >/dev/null 2>&1; rc-service local restart >/dev/null 2>&1
apk add -q --no-cache curl bash ca-certificates iptables ip6tables sudo openssh >/dev/null
# admin user: key-only SSH, passwordless sudo
id $ADMIN >/dev/null 2>&1 || adduser -D -s /bin/bash $ADMIN
passwd -u $ADMIN >/dev/null 2>&1 || true   # unlock (no password set) so sshd allows key login
install -d -m 700 -o $ADMIN -g $ADMIN /home/$ADMIN/.ssh
echo '$ADMIN ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/$ADMIN; chmod 440 /etc/sudoers.d/$ADMIN
sed -i -E 's/^#?PasswordAuthentication .*/PasswordAuthentication no/; s/^#?PermitRootLogin .*/PermitRootLogin no/' /etc/ssh/sshd_config
rc-update add sshd default >/dev/null 2>&1; rc-service sshd restart >/dev/null 2>&1
"
  incus file push "$(dirname "$0")/authorized_keys" $name/home/$ADMIN/.ssh/authorized_keys --uid 1000 --gid 1000 --mode 600
  incus exec $name -- chown -R $ADMIN:$ADMIN /home/$ADMIN/.ssh
done
incus list -c ns4

Memory limits

  • The limit is set once in the profile (limits.memory: 2GiB), so it applies to every node. Nodes 30–32 previously had their own 3 GiB overrides, which were removed. Before lowering the limit, real (anon) usage was checked at about 500 MiB per node; the rest was page cache. No OOM kills followed.
  • lxcfs makes /proc/meminfo inside each container report 2 GiB, so kubelet advertises the correct capacity. Busybox free still shows the host's 11.6 GiB because it uses sysinfo(). That is cosmetic.
  • kubelet only reads machine memory at startup. After the change, k3s-agent was restarted on each node in turn; running pods keep going through an agent restart. The nodes now report capacity=2Gi.
Consider system-reserved

Allocatable currently equals capacity (2Gi), so pods could squeeze k3s itself. Adding --kubelet-arg=system-reserved=memory=256Mi to the agents leaves headroom.

7Incus crash course

Incus manages system containers: full little Linux machines with their own init, IP and users that share the host's kernel. Think of them as lightweight VMs. Run these commands on the OCI VM. wiredboy is in incus-admin, so after logging in again you no longer need sudo.

Do thisCommand
List containersincus list
Shell inside (no SSH)incus exec k8s-oci-30 -- sh
Run one commandincus exec k8s-oci-30 -- apk update
Start / stop / restartincus start|stop|restart k8s-oci-30
Details / start errorsincus info k8s-oci-30 [--show-log]
Effective configincus config show k8s-oci-30 --expanded
Copy filesincus file push ./x k8s-oci-30/root/x · incus file pull k8s-oci-30/etc/hosts .
Snapshot / roll backincus snapshot create k8s-oci-30 pre-x · incus snapshot restore k8s-oci-30 pre-x
Resource limitsincus config set k8s-oci-30 limits.cpu=1 (memory comes from the profile)
Edit the shared profileincus profile edit k8s-node, then restart the containers
Delete for goodincus delete -f k8s-oci-30
Find imagesincus image list images: alpine arch=aarch64

Concepts

  • Image: a template rootfs from images: (linuxcontainers.org).
  • Instance: a container made from an image. launch creates and starts it; init only creates it.
  • Profile: a reusable config bundle. The nodes use default + k8s-node.
  • Device: a NIC or disk. Each node overrides eth0 to pin its MAC.

Recipes

# rebuild a node from scratch
incus delete -f k8s-oci-31
sudo sh ~/vlan800/create-nodes.sh

# share a host dir
incus config device add k8s-oci-30 data \
  disk source=/srv/data path=/data

8Runbook

Route10 (ssh user@host)

wg show wg-oci                  # handshake < 2 min
ip -br link show master br-lan_800 | grep vx800
iptables -S | grep vxlan-oci    # 3 rules
ping -c3 10.255.80.2
/cfg/vxlan-oci.sh               # re-apply (idempotent)

OCI VM (ssh user@host)

sudo wg show wg-oci
sudo bridge fdb show dev vx800  # Pi MACs learned
incus list
ping -c2 172.20.0.23            # a Pi, via the tunnel
sudo ifdown vx800 br800 wg-oci; sudo ifup wg-oci br800 vx800

From the cluster

kubectl get nodes -l netboot.lab/remote=true -o wide
kubectl get nodes -l netboot.lab/remote=true -o custom-columns=NAME:.metadata.name,MEM:.status.capacity.memory

9Lessons & troubleshooting

SymptomCauseFix
Router: ping 10.255.80.2 → "Operation not permitted", even though the handshake workedfw3 OUTPUT policy is DROP; wg-oci is in no zoneAccept on OUTPUT for -o wg-oci, plus INPUT accepts for VXLAN and ICMP (in the script)
Hand-edited router config disappearsThe Alta controller regenerates /etc/configEverything lives in /cfg, started from /cfg/post-cfg.sh
SSH: "REMOTE HOST IDENTIFICATION HAS CHANGED" for the OCI IPInstance rebuiltConfirmed with the owner, then the stale known_hosts entries were replaced
ARP works across the tunnel but nothing else doesbr_netfilter sends bridged frames through iptables FORWARD, whose policy is DROPVLAN800-FWD accepts -i br800 -o br800
Host cannot reach the containersbr800 had no IP172.20.0.29/24 on br800
Host → node: ping works, TCP gets no SYN-ACKCilium host firewallAllow 172.20.0.29/32 (checksum offload tested and ruled out)
Port forward hits DNAT, but the client gets no replyThe reply leaves through the home WAN (asymmetric route)MASQUERADE DNAT'd traffic into br800
free in a container shows 11.6 GiBBusybox reads sysinfo(), which lxcfs does not virtualiseCosmetic: /proc/meminfo is correct
Node capacity unchanged after limits.memory changedkubelet reads memory only at startuprc-service k3s-agent restart
grub-reboot entry still set after bootingbtrfs root, so GRUB cannot write grubenvDo not rely on one-time boots; use the serial console menu
Large transfers stall, small ones workMTU mismatch over the 1370-byte segmentAll VLAN 800 nodes on MTU 1370

10Open items

  • DHCP reservations in the Alta UI for .29–.33, with the MACs above. These addresses sit inside the VLAN 800 DHCP pool, which is static-mapped otherwise.
  • Route10 reboot test: confirm post-cfg.sh brings the tunnel up at boot.
  • kubelet system-reserved on the 2 GiB nodes (see Memory limits).

11This documentation site

It mirrors the cluster wiki at 172.20.0.102 (moved from .100 on 2026-12-01 to make room for Caddy): one static HTML page served by busybox httpd as nobody (65534) with a read-only root filesystem, two replicas pinned to the remote nodes, and the image in the private zot registry. Source: vxlan_k8s/docs-site/. build.py inlines the real config files from the repo into this page at build time, so the code blocks always show what is deployed.

ItemValue
URLhttp://172.20.0.101/, publicly https://vlandoc.9216635.xyz/ (Service docs/vlan800-docs, lbipam.cilium.io/ips)
Image192.168.0.4:8080/2bleere/vlan800-docs:<UTC timestamp> and :latest (arm64)
Deploybash docs-site/deploy.sh: build, then push with push-oci.sh (zot answers 503 instead of 404 for a missing manifest during sync, which breaks docker push), then apply
# VLAN 800 → OCI documentation site. Mirrors docs/k8s-docs: image from the private zot registry,
# 2 replicas on the remote-site nodes, LoadBalancer IP pinned from the Cilium LB-IPAM pool (announced by a Pi, policy 'lan').
apiVersion: v1
kind: Namespace
metadata:
  name: docs
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vlan800-docs
  namespace: docs
  labels: { app: vlan800-docs }
spec:
  replicas: 2
  selector:
    matchLabels: { app: vlan800-docs }
  template:
    metadata:
      labels: { app: vlan800-docs }
    spec:
      automountServiceAccountToken: false
      nodeSelector:
        netboot.lab/remote: "true"
      securityContext:
        runAsNonRoot: true
        runAsUser: 65534
        runAsGroup: 65534
        seccompProfile: { type: RuntimeDefault }
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: kubernetes.io/hostname
          whenUnsatisfiable: ScheduleAnyway
          labelSelector:
            matchLabels: { app: vlan800-docs }
      containers:
        - name: httpd
          image: 192.168.0.4:8080/2bleere/vlan800-docs:IMAGE_TAG
          ports:
            - { name: http, containerPort: 8080 }
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities: { drop: ["ALL"] }
          resources:
            requests: { cpu: 5m, memory: 8Mi }
            limits: { memory: 16Mi }
          readinessProbe:
            httpGet: { path: /, port: http }
            periodSeconds: 10
          livenessProbe:
            httpGet: { path: /, port: http }
            periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: vlan800-docs
  namespace: docs
  annotations:
    lbipam.cilium.io/ips: "172.20.0.101"
spec:
  type: LoadBalancer
  selector: { app: vlan800-docs }
  ports:
    - { name: http, port: 80, targetPort: http }

12History

DateChange
2026-11-30Route10 inspected; /cfg/post-cfg.sh hook found in black; WireGuard keys generated on each end
2026-11-30OCI: WireGuard, VXLAN and br800 through ifupdown; Incus installed; tunnel up with a 1370-byte path verified; VM reboot test passed
2026-11-30Containers k8s-oci-30/31/32 created (Alpine 3.24, k8s-node profile)
2026-11-30Docker and Coolify removed from the VM, including volumes and Coolify's root SSH key; user 2bleere added to the containers
2026-11-30k8s-oci-33 added; 2 GiB memory limit for all nodes through the profile; k3s-agent restarted on each node in turn
2026-11-30Host kernel 6.12 → 7.3.4 (trixie-backports); old kernels removed
2026-11-30Host address 172.20.0.29, port-forward framework, Cilium host firewall allows .29
2026-11-30This site deployed at 172.20.0.101
2026-12-01Rolling restart of k8s-oci-30..33 for the caddy-data profile device; Caddy on 172.20.0.100 (k8s-docs moved to .102); public HTTPS for vlandoc and goldpinger