|
|
|
|
|
im prinzip zpool status für das zfs setup - alles darüber basiert auf zfs datasets - docker nutzt den zfs storage treiber (https://docs.docker.com/storage/storagedriver/zfs-driver/) und baut da seinen docker-graph (also die ganzen ebenen in den images, volumes, etc.pp) aus den zfs sachen, lxd nutzt auch ein dataset als grundlage und packt dort die vm's rein - das grund-image also z.b. ubuntu 20.04 oder so ist auch ein dataset eine vm ist dann ein clone davon der auch schreibar ist, daher die paar komischen artifakte
|
|
|
|
|
|
doku für lxd ist hier: https://linuxcontainers.org/lxd/docs/master/storage
|
|
|
|
|
|
```
|
|
|
mt@epithymetikon:~$ lxc storage ls
|
|
|
+---------+--------+---------+-------------+---------+
|
|
|
| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY |
|
|
|
+---------+--------+---------+-------------+---------+
|
|
|
| default | zfs | m18/lxd | | 7 |
|
|
|
+---------+--------+---------+-------------+---------+
|
|
|
mt@epithymetikon:~$ lxc storage show default
|
|
|
config:
|
|
|
source: m18/lxd
|
|
|
volume.zfs.use_refquota: "true"
|
|
|
zfs.pool_name: m18/lxd
|
|
|
description: ""
|
|
|
name: default
|
|
|
driver: zfs
|
|
|
used_by:
|
|
|
- /1.0/images/2b9d3396fa4b13bd96bcb186e6257b5dbeb2598ec33ee9db7144ed893ed3570d
|
|
|
- /1.0/instances/bauhausfm
|
|
|
- /1.0/instances/matrix
|
|
|
- /1.0/instances/weimarnetz
|
|
|
- /1.0/instances/weimarnetz/snap0
|
|
|
- /1.0/instances/workadventure
|
|
|
- /1.0/profiles/default
|
|
|
status: Created
|
|
|
locations:
|
|
|
- none
|
|
|
mt@epithymetikon:~$
|
|
|
```
|
|
|
|
|
|
wie eine baumstruktur kann man das sich das vorstellen
|
|
|
|
|
|
intern macht der dann magic mit dem ganzen kernel namespaces features
|
|
|
|
|
|
die ganze low-level sache ist z.b. auch hier etwas dokumentiert: https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html - im prinzip gibt's unter linux kein konzept von container, das ist eine zusammenstellung von vielen funktionen - das ganze konzept ist hier ganz gut erklärt: https://platform.sh/blog/2020/the-container-is-a-lie/
|
|
|
|
|
|
```
|
|
|
mt@epithymetikon:~$ lxc config show matrix
|
|
|
architecture: x86_64
|
|
|
config:
|
|
|
image.architecture: amd64
|
|
|
image.description: Debian stretch amd64 (20180317_22:42)
|
|
|
image.os: Debian
|
|
|
image.release: stretch
|
|
|
image.serial: "20180317_22:42"
|
|
|
limits.memory: 64GB
|
|
|
limits.memory.swap: "false"
|
|
|
security.nesting: "true"
|
|
|
volatile.base_image: 2ea2ab1b965581195e57fc91167a7bc7aa624b0f7f01d5808af4981011ee355b
|
|
|
volatile.eth0.host_name: vethbdb582d1
|
|
|
volatile.eth0.hwaddr: 00:16:3e:64:5b:9e
|
|
|
volatile.idmap.base: "0"
|
|
|
volatile.idmap.current: '[{"Isuid":true,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
|
|
|
volatile.idmap.next: '[{"Isuid":true,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
|
|
|
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
|
|
|
volatile.last_state.power: RUNNING
|
|
|
volatile.uuid: 0a8d9314-6505-4ead-b098-9dcb0166892e
|
|
|
devices:
|
|
|
root:
|
|
|
path: /
|
|
|
pool: default
|
|
|
size: 1TB
|
|
|
type: disk
|
|
|
ephemeral: false
|
|
|
profiles:
|
|
|
- default
|
|
|
stateful: false
|
|
|
description: ""
|
|
|
mt@epithymetikon:~$
|
|
|
```
|
|
|
|
|
|
> die ganze low-level sache ist z.b. auch hier etwas dokumentiert: https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html - im prinzip gibt's unter linux kein konzept von container, das ist eine zusammenstellung von vielen funktionen - das ganze konzept ist hier ganz gut erklärt: https://platform.sh/blog/2020/the-container-is-a-lie/
|
|
|
|
|
|
also der the container is a lie post beschreibt die primitiven im kernel die von docker, lxd, kubernetes genutzt werden - ist alles dasselbe auf kernel-ebene mehr oder weniger - da steht auch was zum storage
|
|
|
|
|
|
```
|
|
|
root@epithymetikon:/var/snap/lxd# find /var/snap/lxd -name "*.conf"
|
|
|
/var/snap/lxd/common/lxd/logs/weimarnetz/lxc.conf
|
|
|
/var/snap/lxd/common/lxd/logs/workadventure/lxc.conf
|
|
|
/var/snap/lxd/common/lxd/logs/bauhausfm/lxc.conf
|
|
|
/var/snap/lxd/common/lxd/logs/matrix/lxc.conf
|
|
|
/var/snap/lxd/common/lxc/local.conf
|
|
|
```
|
|
|
```
|
|
|
root@epithymetikon:/var/snap/lxd# cat /var/snap/lxd/common/lxd/logs/bauhausfm/lxc.conf
|
|
|
lxc.log.file = /var/snap/lxd/common/lxd/logs/bauhausfm/lxc.log
|
|
|
lxc.log.level = warn
|
|
|
lxc.console.buffer.size = auto
|
|
|
lxc.console.size = auto
|
|
|
lxc.console.logfile = /var/snap/lxd/common/lxd/logs/bauhausfm/console.log
|
|
|
lxc.mount.auto = proc:rw sys:rw cgroup:mixed
|
|
|
lxc.autodev = 1
|
|
|
lxc.pty.max = 1024
|
|
|
lxc.mount.entry = /dev/fuse dev/fuse none bind,create=file,optional 0 0
|
|
|
lxc.mount.entry = /dev/net/tun dev/net/tun none bind,create=file,optional 0 0
|
|
|
lxc.mount.entry = /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc none rbind,create=dir,optional 0 0
|
|
|
lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none rbind,create=dir,optional 0 0
|
|
|
lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none rbind,create=dir,optional 0 0
|
|
|
lxc.mount.entry = /sys/kernel/config sys/kernel/config none rbind,create=dir,optional 0 0
|
|
|
lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none rbind,create=dir,optional 0 0
|
|
|
lxc.mount.entry = /sys/kernel/security sys/kernel/security none rbind,create=dir,optional 0 0
|
|
|
lxc.mount.entry = /sys/kernel/tracing sys/kernel/tracing none rbind,create=dir,optional 0 0
|
|
|
lxc.mount.entry = /dev/mqueue dev/mqueue none rbind,create=dir,optional 0 0
|
|
|
lxc.include = /snap/lxd/current/lxc/config//common.conf.d/
|
|
|
lxc.arch = linux64
|
|
|
lxc.hook.version = 1
|
|
|
lxc.hook.pre-start = /proc/8397/exe callhook /var/snap/lxd/common/lxd "default" "bauhausfm" start
|
|
|
lxc.hook.stop = /snap/lxd/current/bin/lxd callhook /var/snap/lxd/common/lxd "default" "bauhausfm" stopns
|
|
|
lxc.hook.post-stop = /snap/lxd/current/bin/lxd callhook /var/snap/lxd/common/lxd "default" "bauhausfm" stop
|
|
|
lxc.tty.max = 0
|
|
|
lxc.uts.name = bauhausfm
|
|
|
lxc.mount.entry = /var/snap/lxd/common/lxd/devlxd dev/lxd none bind,create=dir 0 0
|
|
|
lxc.apparmor.profile = lxd-bauhausfm_</var/snap/lxd/common/lxd>//&:lxd-bauhausfm_<var-snap-lxd-common-lxd>:
|
|
|
lxc.seccomp.profile = /var/snap/lxd/common/lxd/security/seccomp/bauhausfm
|
|
|
lxc.idmap = u 0 1000000 1000000000
|
|
|
lxc.idmap = g 0 1000000 1000000000
|
|
|
lxc.environment = http_proxy=
|
|
|
lxc.cgroup.memory.limit_in_bytes = 8000000000
|
|
|
lxc.cgroup.memory.soft_limit_in_bytes = 7200000000
|
|
|
lxc.cgroup.memory.swappiness = 0
|
|
|
lxc.cgroup.cpu.shares = 102
|
|
|
lxc.mount.auto = shmounts:/var/snap/lxd/common/lxd/shmounts/bauhausfm:/dev/.lxd-mounts
|
|
|
lxc.net.0.type = phys
|
|
|
lxc.net.0.name = eth0
|
|
|
lxc.net.0.flags = up
|
|
|
lxc.net.0.link = veth6c07fd7d
|
|
|
lxc.rootfs.path = dir:/var/snap/lxd/common/lxd/containers/bauhausfm/rootfs
|
|
|
lxc.mount.entry = /var/snap/lxd/common/lxd/devices/bauhausfm/disk.cert.etc-ssl-bauhaus.fm- etc/ssl/bauhaus.fm/ none bind,create=dir 0 0
|
|
|
```
|
|
|
|
|
|
that's all
|
|
|
|
|
|
vm's laufen entweder als zvol für ihren storage und oder als qemu oder raw-image und booten halt ihren eigenen kernel, d.h. das ist davon nochmal unabhängig - container ist alles nur linux und prinzip ist's diese eine konfigurationsdatei und ein wenig go-code in lxc, ist nicht viel anders in docker oder k8s - aber etwas andere konfiguration das ist dann dieses containerd und runc und so kram
|
|
|
|
|
|
irgendwann ist's auch möglich das man innerhalb des containers zfs selbst verwalten kann - https://github.com/openzfs/zfs/pull/12263 - das geht gerade nicht weil der docker zfs storage treiber nicht innerhalb eines containers funktioniert und overlayfs für zfs auch nicht geht - https://github.com/openzfs/zfs/issues/8648 - overlayfs kümmert sich auch darum das diese ganzen ebenen effizient gespeichert werden können
|
|
|
|
|
|
z.b. mit ceph ginge das |