View
247
Download
2
Category
Preview:
Citation preview
Контейнеры“под капотом”
Максим Жилинский
Для могут использоваться контейнеры?
Локальная разработка и тестирование
Командная разработка
Continious Integration
Разворачивание контейнеров в production
PaaS
Ваш вариант?..
Задачи контейнеров
Изоляция окруженияОграничение ресурсов
man 2 fork
NOTES… Since version 2.3.3, rather than invoking the kernel's fork() system call, the glibc fork() wrapper that is provided as part of the NPTL threading implementation invokes clone(2) with flags that provide the same effect as the traditional system call.
Изоляция окружения
Linux Namespaces2.4.19 (2002)
2.6.19 (2006)
2.6.24 (2008)
2.6.29(2009)
3.3(2012)
3.8(2013)
Mount ✔ ✔ ✔ ✔ ✔ ✔UTS ✔ ✔ ✔ ✔ ✔IPC ✔ ✔ ✔ ✔ ✔PID ✔ ✔ ✔ ✔
Network ✔ ✔ ✔User ✔
Namespaces
Process ID (PID)
Network
Mount
UTS (hostname)
Inter-process communication (IPC)
User
Linux process tree
Изоляция процессов
Изоляция файловой системы
Old-fashioned: chroot
Изоляция файловой системы
pivot_root спешит на помощь
Union mount
foo/|-- common| `-- foo|-- foo-1`-- foo-child |-- foo-child-1 `-- foo-child-2
bar/|-- bar-1|-- bar-2|-- bar-child| `-- bar-child-1`-- common `-- bar
result/|-- bar-1|-- bar-2|-- bar-child| `-- bar-child-1|-- common| |-- bar| `-- foo|-- foo-1`-- foo-child |-- foo-child-1 `-- foo-child-2
+ =
Union filesystems
UnionFS
AUFS
OverlayFS
…
Runtime filesystem – read-write
Application files added – read-only
Ubuntu Trusty (14.04) – read-only
Ограничение ресурсов
cgroupsInitial release in kernel 2.6.24 (2007)
cgroups subsystems
CPU
RAM
Disk bandwidth
Network bandwidth
more…
CPU subsystem heirarchy
CPU+Memory subsystem heirarchy
Реализации контейнеров linux
LXC
Docker
LMCTFY
OpenVZ
CloudFoundry Warden/Garden
Тысячи их!
Реализации в других OS
FreeBSD jails (2000)
OpenBSD/NetBSD sysjail (2007)
Solaris containers (2004)
HP-UX Containers (2007)
AIX WPARs (2007)
Спасибо за внимание
Recommended