work on LXD blog post

This commit is contained in:
Amolith 2023-07-18 13:21:24 -04:00
parent 7e7bffe3d7
commit 0dafe12f60
Signed by: Amolith
GPG Key ID: 8AE30347CE28D101
1 changed files with 72 additions and 0 deletions

View File

@ -34,3 +34,75 @@ there's unfortunately nothing I can do about that.
on bare metal servers as necessary. on bare metal servers as necessary.
- **Density:** - **Density:**
- **Cleanliness:** - **Cleanliness:**
## Virtual machines
```goat
.---------------------------------.
| .-------. .-------. .-------. |
| | Guest | | Guest | | Guest | |
| | OS | | OS | | OS | |
| .---+---' .---+---' .---+---' |
| .--+----. .--+----. .--+----. |
| | Guest | | Guest | | Guest | |
| | Kernel | | Kernel | | Kernel | |
| .---+---' .---+---' .---+---' |
| .--+----------+----------+----. |
| | Hypervisor | |
| .--------------+--------------' |
| .-------------+---------------. |
| | Host Kernel | |
| .-----------------------------' |
.---------------------------------'
```
## Containers
```goat
Application containers System containers
.---------------------------------. .------------------------------.
| .-------. .-------. .-------. | | .------. .------. .------. |
| | App 01 | | App 02 | | App 03 | | | | Guest | | Guest | | Guest | |
| '---+---' '---+---' '---+---' | | | OS | | OS | | OS | |
| .--+----------+----------+----. | | '---+--' '---+--' '---+--' |
| | Hypervisor | | | .--+---------+---------+---. |
| '--------------+--------------' | | | Host Kernel | |
| .-------------+---------------. | | '--------------------------' |
| | Host Kernel | | '------------------------------'
| '-----------------------------' |
'---------------------------------'
```
## When to use which
### Virtual machines
- Virtualising esoteric hardware
- Virtualising non-Linux operating systems (Windows, macOS)
- Completely isolating processes from one another with a decades-old, battle-tested technique
> See Drew DeVault's blog post [_In praise of qemu_](https://earl.run/rmBs) for a great use of VMs
### Application containers
- Microservices
- Extremely reproducible builds
- (NixOS.org would likely be a better fit though)
- Dead-set on using cloud platforms with extreme scaling capabilities (AWS, GCP, etc.)
- When the app you want to run is _only_ distributed as a Docker container and
the maintainers adamantly refuse to support any other deployment method
- (Docker does run in LXD 😉)
### System containers
- Anything not listed above 👍
## Crash course to LXD
1. Install snap following [Canonical's tutorial](https://earl.run/ZvUK)
- LXD is natively packaged for Arch and Alpine, but configuration can be a massive headache.
2. `sudo snap install lxd`
3. `lxd init`
4. `lxc image copy images:debian/11 local: --alias deb-11`
5. `lxc launch deb-11 container-name`
6. `lxc shell container-name`