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.
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
br-lan_800 · 172.20.0.1 · OpenWrt 21.02wg-oci 10.255.80.1 ↔ .2 · UDP 51820vx800 · UDP 4789 · point-to-pointbr800 · port-forward gatewayTopology
enp0s6 and are DNAT'd into br800 (dashed amber).Addressing plan
| Address | What | Where |
|---|---|---|
172.20.0.1/24 | VLAN 800 gateway, DHCP, DNS | Route10 br-lan_800 |
172.20.0.21–.28 | Raspberry Pi nodes | home |
172.20.0.29 | OCI host on VLAN 800 (MAC 02:00:00:80:00:29) | OCI br800 |
172.20.0.30–.33 | Incus k8s nodes (MAC 00:16:3e:80:00:30–33) | OCI containers |
172.20.0.100–.254 | Cilium LB-IPAM pool lan | announced on L2 |
10.255.80.1/30 · .2/30 | WireGuard transit / VXLAN endpoints | Route10 · OCI |
149.130.223.219:51820/udp | WireGuard listener | OCI 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.
AllowedIPsis 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.1and.2(remoteset 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
| Layer | MTU | Why |
|---|---|---|
| Internet path | 1500 | public Internet |
wg-oci | 1420 | 1500 − 80 (WireGuard over IPv4/IPv6 worst case) |
vx800, br800, container eth0 | 1370 | 1420 − 50 (outer IP 20 + UDP 8 + VXLAN 8 + inner Ethernet 14) |
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
| Fact | Consequence |
|---|---|
| OpenWrt 21.02.1, kernel 5.4, aarch64, 1 GB RAM | Kernel 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 DROP | Explicit 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 controller | Hand-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 & )
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
| Item | Value |
|---|---|
| Instance | oci-rr, Ampere arm64, 2 vCPU, 11 GiB RAM, 200 GB btrfs root (@rootfs subvolume) |
| OS | Debian 13 (trixie), kernel 7.3.4+deb13-cloud-arm64 from trixie-backports |
| Network management | ifupdown (/etc/network/interfaces), DHCP on enp0s6 |
| Admin | wiredboy (sudo, member of incus-admin) |
| Installed for this | wireguard-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 = 1The containers share the host kernel, so kernel modules and sysctls for Kubernetes and Cilium have to be set on the host.
Kernel 7.3
- Installed
linux-image-cloud-arm64fromtrixie-backports, which gave 7.3.4-1~bpo13+1. The meta package now tracks backports, so future 7.x updates arrive withapt upgrade. - 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.
- 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. - Set
GRUB_DEFAULT=0(newest kernel) again and removed all 6.12 kernels (.111 residue, .115, .118).
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.ioand plugin packages, the Docker apt repo and thedockergroup. - Deleted
/var/lib/dockerand/var/lib/containerd(including 6 volumes),/opt/containerd,/data/coolifyand the apt cache. - Deleted Docker's bridges, iptables chains and NAT rules. One rule masqueraded
10.0.0.0/24, becausedocker0overlapped the VCN subnet ofenp0s6. - 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.
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
| Site | Backend |
|---|---|
| vlandoc.9216635.xyz | vlan800-docs.docs.svc.cluster.local:80 |
| goldpinger.9216635.xyz | goldpinger.goldpinger.svc.cluster.local:8080 |
- Announcing .100: the Service has
externalTrafficPolicy: Localand the labelnetboot.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/caddyby the Incus profile devicecaddy-dataand 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/Dockerfileis the official image withsetcap -r. The stock binary carriescap_net_bind_service, and with all capabilities dropped andallowPrivilegeEscalation: falsethe 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, bumpcaddyfile/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
| Container | IP | MAC | RAM | Role |
|---|---|---|---|---|
k8s-oci-30 | 172.20.0.30 | 00:16:3e:80:00:30 | 2 GiB | agent remote |
k8s-oci-31 | 172.20.0.31 | 00:16:3e:80:00:31 | 2 GiB | agent remote |
k8s-oci-32 | 172.20.0.32 | 00:16:3e:80:00:32 | 2 GiB | agent remote |
k8s-oci-33 | 172.20.0.33 | 00:16:3e:80:00:33 | 2 GiB | agent 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/meminfoinside each container report 2 GiB, so kubelet advertises the correct capacity. Busyboxfreestill shows the host's 11.6 GiB because it usessysinfo(). That is cosmetic. - kubelet only reads machine memory at startup. After the change,
k3s-agentwas restarted on each node in turn; running pods keep going through an agent restart. The nodes now reportcapacity=2Gi.
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 this | Command |
|---|---|
| List containers | incus list |
| Shell inside (no SSH) | incus exec k8s-oci-30 -- sh |
| Run one command | incus exec k8s-oci-30 -- apk update |
| Start / stop / restart | incus start|stop|restart k8s-oci-30 |
| Details / start errors | incus info k8s-oci-30 [--show-log] |
| Effective config | incus config show k8s-oci-30 --expanded |
| Copy files | incus file push ./x k8s-oci-30/root/x · incus file pull k8s-oci-30/etc/hosts . |
| Snapshot / roll back | incus snapshot create k8s-oci-30 pre-x · incus snapshot restore k8s-oci-30 pre-x |
| Resource limits | incus config set k8s-oci-30 limits.cpu=1 (memory comes from the profile) |
| Edit the shared profile | incus profile edit k8s-node, then restart the containers |
| Delete for good | incus delete -f k8s-oci-30 |
| Find images | incus image list images: alpine arch=aarch64 |
Concepts
- Image: a template rootfs from
images:(linuxcontainers.org). - Instance: a container made from an image.
launchcreates and starts it;initonly creates it. - Profile: a reusable config bundle. The nodes use
default+k8s-node. - Device: a NIC or disk. Each node overrides
eth0to 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=/data8Runbook
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 vx800From 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
| Symptom | Cause | Fix |
|---|---|---|
Router: ping 10.255.80.2 → "Operation not permitted", even though the handshake worked | fw3 OUTPUT policy is DROP; wg-oci is in no zone | Accept on OUTPUT for -o wg-oci, plus INPUT accepts for VXLAN and ICMP (in the script) |
| Hand-edited router config disappears | The Alta controller regenerates /etc/config | Everything lives in /cfg, started from /cfg/post-cfg.sh |
| SSH: "REMOTE HOST IDENTIFICATION HAS CHANGED" for the OCI IP | Instance rebuilt | Confirmed with the owner, then the stale known_hosts entries were replaced |
| ARP works across the tunnel but nothing else does | br_netfilter sends bridged frames through iptables FORWARD, whose policy is DROP | VLAN800-FWD accepts -i br800 -o br800 |
| Host cannot reach the containers | br800 had no IP | 172.20.0.29/24 on br800 |
| Host → node: ping works, TCP gets no SYN-ACK | Cilium host firewall | Allow 172.20.0.29/32 (checksum offload tested and ruled out) |
| Port forward hits DNAT, but the client gets no reply | The reply leaves through the home WAN (asymmetric route) | MASQUERADE DNAT'd traffic into br800 |
free in a container shows 11.6 GiB | Busybox reads sysinfo(), which lxcfs does not virtualise | Cosmetic: /proc/meminfo is correct |
Node capacity unchanged after limits.memory changed | kubelet reads memory only at startup | rc-service k3s-agent restart |
grub-reboot entry still set after booting | btrfs root, so GRUB cannot write grubenv | Do not rely on one-time boots; use the serial console menu |
| Large transfers stall, small ones work | MTU mismatch over the 1370-byte segment | All 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.shbrings 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.
| Item | Value |
|---|---|
| URL | http://172.20.0.101/, publicly https://vlandoc.9216635.xyz/ (Service docs/vlan800-docs, lbipam.cilium.io/ips) |
| Image | 192.168.0.4:8080/2bleere/vlan800-docs:<UTC timestamp> and :latest (arm64) |
| Deploy | bash 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
| Date | Change |
|---|---|
| 2026-11-30 | Route10 inspected; /cfg/post-cfg.sh hook found in black; WireGuard keys generated on each end |
| 2026-11-30 | OCI: WireGuard, VXLAN and br800 through ifupdown; Incus installed; tunnel up with a 1370-byte path verified; VM reboot test passed |
| 2026-11-30 | Containers k8s-oci-30/31/32 created (Alpine 3.24, k8s-node profile) |
| 2026-11-30 | Docker and Coolify removed from the VM, including volumes and Coolify's root SSH key; user 2bleere added to the containers |
| 2026-11-30 | k8s-oci-33 added; 2 GiB memory limit for all nodes through the profile; k3s-agent restarted on each node in turn |
| 2026-11-30 | Host kernel 6.12 → 7.3.4 (trixie-backports); old kernels removed |
| 2026-11-30 | Host address 172.20.0.29, port-forward framework, Cilium host firewall allows .29 |
| 2026-11-30 | This site deployed at 172.20.0.101 |
| 2026-12-01 | Rolling 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 |