Top 7 LXC/LXD Plays When Kubernetes Is Overkill
Lean, fast, and sane patterns to ship containers without summoning a control plane.
Top 7 LXC/LXD Plays When Kubernetes Is Overkill
Lean, fast, and sane patterns to ship containers without summoning a control plane.

Seven LXC/LXD patterns for teams that don’t need Kubernetes: single-host PaaS, golden images, DB sandboxes, edge fleets, snapshots, and live migration.
Kubernetes is amazing. It’s also a lot — especially when your use case is “one beefy box” or “a few edge nodes with flaky Wi-Fi.” If you want container isolation, snapshots, networking, and repeatability without a sprawling cluster, LXC/LXD is the pragmatic sweet spot. Below are seven plays that let you move fast, keep bills low, and still sleep at night.
1) Single-Host PaaS: profiles + cloud-init = push-and-run
You can turn one physical server into a tidy multi-app platform using profiles and cloud-init. Each app gets a container with quotas, a routable IP, and a one-file boot script.
# one-time setup
lxd init --auto
lxc network create br0 ipv4.address=10.10.10.1/24 ipv4.nat=true ipv6.address=none
lxc storage create local zfs size=200GB # or btrfs/lvm/dir
# app profile
lxc profile create app
lxc profile set app limits.cpu 2
lxc profile set app limits.memory 2GiB
lxc profile device add app eth0 nic network=br0 name=eth0
# launch an app container with cloud-init userdata
lxc launch images:ubuntu/22.04 myapp -p default -p app -c user.user-data="$(cat <<'YAML'
#cloud-config
packages: [nginx]
runcmd:
- systemctl enable --now nginx
YAML
)"
Why it works: You get a Heroku-ish feel — lxc launch, it comes up serving—without an orchestrator. Scale up by cloning and pinning CPU/mem per container.
2) Golden Images You Can Trust: publish → version → roll back
Bake once, run everywhere. Use an “image builder” container to assemble your stack, publish it as an LXD image with a semantic alias, and pin environments to that tag.
# build image in a throwaway container, then publish
lxc launch images:ubuntu/22.04 app-build
lxc exec app-build -- bash -lc "apt-get update && apt-get -y install nodejs"
lxc publish app-build --alias app-node:1.2.0 description="Node runtime 18.x + tools"
lxc delete -f app-build
# launch many from the immutable image
lxc launch app-node:1.2.0 app-1
lxc launch app-node:1.2.0 app-2
Rollbacks are instant: stop, delete, re-launch with the previous tag. Pair with projects to isolate teams’ images and ACLs.
3) Database Sandboxes: copy-on-write snapshots for fearless testing
Spin up realistic DBs in seconds using snapshots and ZFS/btrfs copy-on-write. It’s perfect for schema drills, migration rehearsals, and local analytics reproductions.
# base database
lxc launch images:ubuntu/22.04 pg-base
lxc exec pg-base -- bash -lc "apt -y install postgresql && systemctl enable --now postgresql"
lxc snapshot pg-base clean
# ephemeral sandboxes
for n in {1..3}; do
lxc copy pg-base/clean pg-sbx-$n
lxc exec pg-sbx-$n -- bash -lc "psql -U postgres -c 'create database test;'"
done
# nuke and reset in one command:
lxc restore pg-sbx-1 clean
Bonus: mount a dataset into the container for big fixture sets; the sandbox remains small while reads stay fast.
4) Edge & Lab Fleets: projects + remote clients + simple GitOps
You don’t need a control plane to manage five-to-twenty nodes. Use LXD remotes with a GitOps repo of YAML (profiles, cloud-init) and push changes through a tiny wrapper.
laptop ─┬─ lxd remote add edge-1 https://edge1.example.com
├─ lxd remote add edge-2 https://edge2.example.com
└─ git repo: /fleet/profiles/*.yaml /fleet/apps/*.yaml
# apply a profile to multiple remotes
for r in edge-1 edge-2; do
lxc --target $r profile edit sensor < fleet/profiles/sensor.yaml
lxc --target $r launch images:alpine/3.19 sensor-$(hostname)-$r -p sensor
done
Let’s be real: for small fleets, SSH + LXD remotes + code review beats a mini-K8s you’ll spend weekends babysitting.
5) “Feels Like a VM”: systemd, nesting, and privileged-less power
Sometimes you want system services, not PID-1 shims. LXC containers run a full init, so systemd works naturally — timers, journald, the lot — yet isolation remains light.
# enable nesting if you need Docker-in-LXC or extra kernel features
lxc profile set app security.nesting true
lxc config set myapp boot.autostart true
lxc exec myapp -- systemctl status nginx
You can also pin NUMA, add GPUs, and map devices:
lxc profile device add app gpu gpu
lxc profile set app limits.hugepages 1GiB
Rule of thumb: reach for a VM only when you truly need a different kernel or strong virtualization boundaries.
6) Live Migration & Maintenance Windows: move without the outage
With shared storage (Ceph, ZFS replication) or local storage plus rsync, you can move containers between hosts for kernel updates or hardware swaps.
# minimal downtime live migration with pre-copy (requires shared storage)
lxc move --target host-b app-1
# otherwise, stop-copy-start
lxc stop app-1 && lxc move --target host-b app-1 && lxc start app-1
Pair it with a simple anycast VIP or HAProxy to drain connections, move, and bring traffic back. Zero Slack panics.
7) Networking That Doesn’t Fight You: bridges, macvlan, and policies
LXD’s network primitives cover 95% of needs without CNI drama.
- Bridge (br0) with NAT for easy internet access.
- macvlan/ipvlan to put containers directly on the LAN (good for appliances).
- OVN if you need overlay isolation and security groups.
# bridge with DHCP/NAT
lxc network create br0 ipv4.address=10.42.0.1/24 ipv4.nat=true
# put a container straight on the physical NIC (no host access)
lxc profile device add onlan eth0 nic nictype=macvlan parent=eno1 name=eth0
# firewall egress for a container
lxc config device add myapp egress proxy listen=tcp:0.0.0.0:0 connect=tcp:api.example.com:443
ASCII map
[Host NIC eno1]──[br0]───(NAT)──Internet
├── myapp (10.42.0.10)
├── api (10.42.0.11)
└── pg (10.42.0.12)
Clean, predictable, debuggable with lxc exec <c> -- ip a and tcpdump -i br0.
Operational habits that make LXD sing
- Projects for blast radius.
lxc project create team-ato isolate quotas, images, and ACLs. - Backups you can restore blindfolded.
lxc export <name> --instance-onlynightly; practicelxc import. - Resource limits by default. Set
limits.cpu,limits.memory, and I/O priority in the base profile. - Security first. Stick to unprivileged containers; only use
security.privilegedwhen absolutely necessary, and document why. - Observability. Ship logs with journald-forwarding, and scrape node/container metrics via node exporter or
lxc info --resourcesinto Prometheus.
Quickstart “just enough LXD” for a small team
# 1) Init
lxd init --auto
lxc storage create projects zfs size=300GB
lxc network create br0 ipv4.address=10.88.0.1/24 ipv4.nat=true
# 2) Projects & profiles
lxc project create apps
lxc project switch apps
lxc profile create base
lxc profile device add base eth0 nic network=br0 name=eth0
lxc profile set base limits.cpu 2
lxc profile set base limits.memory 2GiB
# 3) Launch services
lxc launch images:ubuntu/22.04 api -p base
lxc launch images:ubuntu/22.04 web -p base
lxc launch images:ubuntu/22.04 db -p base
From there, layer on golden images, snapshots, and a tiny GitOps repo with your profiles and cloud-init snippets.
When to still choose Kubernetes
- You need auto-healing across many nodes with declarative schedulers.
- You ship dozens of microservices with per-pod policy and mesh-level routing.
- Platform teams depend on ecosystem add-ons (HPA/OPA/CSI) and third-party operators.
If your world is smaller, simpler, or closer to metal, LXC/LXD saves time and brain cells.
Conclusion
You don’t have to rent a battleship to cross a lake. LXC/LXD gives you fast boots, honest isolation, snapshots, and sane networking — perfect for single-host PaaS, golden images, DB sandboxes, edge fleets, VM-like services, migrations, and straightforward networks. Start with one profile and one app. Once you feel the speed, you’ll wonder why you dragged a scheduler into it.
메타데이터
- post_id
- cec8cd7ce0e1
- slug
- top-7-lxc-lxd-plays-when-kubernetes-is-overkill-cec8cd7ce0e1
- url
- https://medium.com/@kaushalsinh73/top-7-lxc-lxd-plays-when-kubernetes-is-overkill-cec8cd7ce0e1
- canonical_url
- https://medium.com/@kaushalsinh73/top-7-lxc-lxd-plays-when-kubernetes-is-overkill-cec8cd7ce0e1
- author_url
- https://medium.com/@kaushalsinh73
- status
- ok
- fetched_at
- 2026-06-12 07:40:50