Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LXC最新情報 (2014年9月)

tenforward
September 06, 2014

LXC最新情報 (2014年9月)

第4回コンテナ型仮想化の情報交換会の発表資料です。
参考となる情報にはPDF中からリンクをしていますが、資料中のリンクは Speaker Deck 上ではクリックできないので PDF をダウンロードしてご覧ください。

tenforward

September 06, 2014
Tweet

More Decks by tenforward

Other Decks in Technology

Transcript

  1. LXC࠷৽৘ใ
    (2014 ೥ 9 ݄)
    Ճ౻ହจ
    2014-09-06
    1

    View full-size slide

  2. ୭?
    Ճ౻ହจ
    ▶ ϑΝʔεταʔόגࣜձࣾɹج൫։ൃ෦

    ΤϯδχΞืूதͰ͢
    ▶ http://www.ten-forward.ws/
    ▶ @ten forward
    ▶ http://gplus.to/tenforward
    ▶ https://github.com/tenforward
    2

    View full-size slide

  3. ୭?
    ▶ 2010 ೥ࠒʹ cgroup ͷௐࠪΛ࢝Ίͨͷ͕͖ͬ
    ͔͚ͰίϯςφपลΛ৭ʑ͓͔͚ͬͯͨͷ͕
    ߴͯ͜͡ͷษڧձΛ΍ͬͯ·͢
    ▶ LXC man pages ೔ຊޠ༁
    ▶ lxc ͷίϛοτ਺͚ͩݟΔͱୈ 4 Ґ
    3

    View full-size slide

  4. ୭?
    ▶ Plamo Linux ϝϯςφ
    ▶ LXC ͰֶͿίϯςφೖ໳ɹʔܰྔԾ૝Խ؀ڥ
    Λ࣮ݱ͢Δٕज़ gihyo.jp Ͱ࿈ࡌ
    ▶ ʲվగ৽൛ʳLinux ΤϯδχΞཆ੒ಡຊ (ٕ
    ज़ධ࿦ࣾ) 4

    View full-size slide

  5. ୭?
    ▶ ϒϩά΍ͬͯ·͢
    ▶ http://d.hatena.ne.jp/defiant/
    5

    View full-size slide

  6. ΞδΣϯμ
    લճͷ౦ژͷษڧձ (2013-10-05) Ҏ߱ͷ LXC
    ͷ Update ͷ঺հ
    ▶ LXC 1.0.0
    ▶ cgmanager
    ▶ ΧʔωϧͷਐԽͱ 1.0.x
    ▶ ͦͷଞͷ৘ใ (೔ຊޠαΠτͱ͔)
    6

    View full-size slide

  7. LXC 1.0.0 ϦϦʔε
    ▶ LXC 1.0.0 ϦϦʔε (2014-02-20)
    ▶ 2 ݄த०·Ͱ৽ػೳ௥Ճ͞Ε·͘Γ (13 ೔ʹ৽
    ػೳ௥ՃΛౚ݁)
    ▶ ݱࡏ LXC 1.0.5 (2014-07-14 ϦϦʔε)
    7

    View full-size slide

  8. LXC 1.0 ৽ػೳ/ಛ௕ (1)
    ▶ ֤छσΟετϦϏϡʔγϣϯͷίϯςφ͕Ұ
    ൃͰ࡞੒Ͱ͖ΔςϯϓϨʔτ 14 छྨ

    લճษڧձ࣌͸ͳ͔ͬͨ CentOS ςϯϓϨʔτ
    ͕௥Ճ
    ▶ ΞϓϦέʔγϣϯίϯςφςϯϓϨʔτ 2
    छ (sshd, busybox)

    $ ls /usr/share/lxc/templates/
    lxc-alpine* lxc-cirros* lxc-openmandriva* lxc-ubuntu*
    lxc-altlinux* lxc-debian* lxc-opensuse* lxc-ubuntu-cloud*
    lxc-archlinux* lxc-download* lxc-oracle*
    lxc-busybox* lxc-fedora* lxc-plamo*
    lxc-centos* lxc-gentoo* lxc-sshd*

    8

    View full-size slide

  9. LXC 1.0 ৽ػೳ/ಛ௕ (2)
    ▶ μ΢ϯϩʔυςϯϓϨʔτͷ௥Ճ

    ͋Β͔͡ΊϏϧυ͞ΕͨΠϝʔδΛݩʹͯ͠ί
    ϯςφΛ࡞੒

    ެࣜαΠτͷΠϝʔδ͸ LXC ෇ଐͷςϯϓϨʔ
    τΛݩʹ࡞੒͞Ε͍ͯΔ
    ▶ CentOS(6,7)
    ▶ Debian(jessie,sid,wheezy)
    ▶ Fedora(19,20)
    ▶ Gentoo(current)
    ▶ Oracle(6.5)
    ▶ Plamo(5.x)
    ▶ Ubuntu(lucid,precise,trusty,utopic)
    ▶ openSUSE(12.3) (Πϝʔδ͸͋Δ͚ͲίϚϯυͰϦετදࣔͯ͠΋Ϧε
    τʹͳ͍??)
    9

    View full-size slide

  10. LXC 1.0 ৽ػೳ/ಛ௕ (3)
    ▶ cgmanager αϙʔτ (cgroup ؅ཧ)
    ▶ ৭ʑͳετϨʔδόοΫΤϯυͷαϙʔτ
    (લճ঺հࡁ)

    σΟϨΫτϦ (default)
    ▶ btrfs
    ▶ zfs
    ▶ lvm
    ▶ loop device
    ▶ aufs
    ▶ overlayfs
    10

    View full-size slide

  11. LXC 1.0 ৽ػೳ/ಛ௕ (4)
    ▶ Ϋϩʔϯͱεφοϓγϣοτ (લճ঺հࡁ)
    ▶ stable ͳ API (liblxc1)
    ▶ ެࣜ API όΠϯσΟϯά
    ▶ Python 3 (in tree)
    ▶ Python 2.7 (out of tree)
    ▶ lua (in tree)
    ▶ Go (out of tree)
    ▶ ruby (out of tree)
    ▶ ඇಛݖίϯςφαϙʔτ
    ▶ υΩϡϝϯτͷॆ࣮
    ▶ API υΩϡϝϯτͷ௥Ճ

    ೔ຊޠ man pages (લճ঺հࡁ)
    11

    View full-size slide

  12. LXC 1.0 ৽ػೳ/ಛ௕ (5)
    ▶ ηΩϡϦςΟ
    ▶ SELinux, AppArmor αϙʔτ
    ▶ seccomp

    ίϯςφ͝ͱʹέʔύϏϦςΟΛࢦఆՄೳ
    12

    View full-size slide

  13. LXC 1.0 Update
    ▶ ςϯϓϨʔτΛ࢖༻ͯ͠࡞੒ͨ͠ίϯςφͰ
    σϑΥϧτͷ seccomp profile ͷద༻
    (1.0.5)
    ▶ lxc-autostart ͷಈ͖͕มΘͬͨ (systemd
    ରࡦ) (1.0.4)
    ▶ LVM όοΫΤϯυͷ࣌ʹεφοϓγϣοτ
    ͕͏·͘ಈ͔ͳ͍ͷͰҰ࣌తʹແޮԽ͞Εͯ
    ͍Δ (͓ͦΒ͘ 1.0.6)
    13

    View full-size slide

  14. cgmanager(1)
    ▶ 2013 ೥ 11 ݄຤ʹϦϙδτϦ։ઃ
    ▶ 2014 ೥ 1 ݄ʹ LXC Ͱαϙʔτ
    ▶ ݱࡏ 0.30 (2014-09-05 ݱࡏ)
    ▶ Ubuntu 14.04 LTS ϦϦʔε࣌఺Ͱ͸ LXC
    ύοέʔδ͸ cgmanager αϙʔτͰ࡞੒
    ▶ cgroupfs ͸௚઀৮ΒͣʹԿΒ͔ͷΤʔδΣϯ
    τܦ༝Ͱ৮Δ͜ͱʹ͠Α͏ɺͱ͍͏ྲྀΕ
    ▶ cgmanager ʹ DBus ϝοηʔδΛૹͬͯ
    cgroup Λ؅ཧ
    14

    View full-size slide

  15. cgmanager(2)
    ▶ Ubunt 14.04 LTS Ͱ͸ىಈͯ͠΋ cgroupfs
    ͕ͳͦ͞͏ (systemd ͕࡞Δ΍ͭ͸͋Δ͚Ͳ)

    $ ls /sys/fs/cgroup/
    cgmanager systemd

    ▶ Ubuntu 12.04 Ͱ͸ cgroup-lite ύοέʔδ
    Ͱ cgroupfs ΛϚ΢ϯτ

    $ ls /sys/fs/cgroup/
    blkio cpu cpuacct cpuset devices freezer hugetlb memory perf_e

    15

    View full-size slide

  16. cgmanager(3)
    ▶ ࣮͸৽ͨʹ mount namespace Λ࡞੒

    $ sudo ./nsenter --target ‘pgrep cgmanager‘ --mount \
    > -- ls /run/cgmanager/fs/
    blkio cpuacct devices hugetlb none,name=systemd
    cpu cpuset freezer memory perf_event

    ▶ nsenter ίϚϯυͰ cgmanager ͕࡞੒ͨ͠ผͷ
    mount namespace ্Ͱ ls ίϚϯυΛ࣮ߦ

    ϗετ OS ͷ mount namespace ͱҟͳΔͷͰ
    ϗετ OS ͔Βݟ͑ͳ͍
    16

    View full-size slide

  17. ΧʔωϧͷਐԽͱLXC
    ·ͩ·ͩΧʔωϧ͕ਐԽ͍ͯ͠Δ/मਖ਼͞Ε͍ͯ
    ΔͷͰͨ·ʹ LXC Ͱಈ͔ͳ͘ͳΔػೳ͕ग़ͯ͘
    Δ͜ͱ͕͋Δ (ಛʹ user namespace पล)
    ▶ 3.12 Ͱ lxc-attach ͕ಈ͔ͳ͘ͳͬͨ

    Χʔωϧଆͷमਖ਼Ͱಈ͘Α͏ʹͳΔ (3.12.9,
    3.13 Ͱमਖ਼)
    ▶ 3.15 Ͱඇಛݖίϯςφ΁ͷ lxc-attach ͕ಈ͔ͳ͘
    ͳͬͨ
    ▶ LXC 1.0.4 Ͱमਖ਼
    ▶ 3.14.8, 3.15 Ͱඇಛݖίϯςφ͕ಈ͔ͳ͘ͳͬͨ
    ▶ LXC 1.0.5 Ͱमਖ਼
    ▶ non-root ͷ User Namespace ಺ͷ mount ࣌ͷಈ࡞ͷ
    มߋ
    ▶ LXC 1.0.6 Ͱमਖ਼༧ఆ
    17

    View full-size slide

  18. LXC 1.1
    ▶ ݱࡏ 1.1.0alpha1 (2014-09-05 ݱࡏ)
    ▶ CRIU ʹΑΔ checkpoint/restore αϙʔτ

    ҰԠಈ͖·ͨ͠
    ▶ ͋ͱ͸ࠓͷॴࡉ͔͍վྑ
    ▶ lxc-start ίϚϯυͰσʔϞϯϞʔυ (-d) ͕σ
    ϑΥϧτʹ

    ετϨʔδόοΫΤϯυͱͯ͠ nbd αϙʔτ

    σϑΥϧτͷεφοϓγϣοτσΟϨΫτϦͷ
    มߋ
    (/var/lib/lxcsnaps ͔Β/var/lib/$c/snaps)
    ▶ lxc-execute Ͱ init.lxc.static Λ bind
    mount ͢ΔΑ͏ʹ
    18

    View full-size slide

  19. LXC೔ຊޠαΠτ
    LXC ͷ೔ຊޠαΠτ͕ linuxcontainers.org ҎԼ
    ʹҠಈ͠·ͨ͠ɻ
    ▶ https://linuxcontainers.org/jp/
    ▶ ࠓޙ೔ຊಠࣗͷ৘ใ΋Ճ͍͖͍͑ͯͨͱࢥͬ
    ͍ͯ·͢ɻ 19

    View full-size slide

  20. ࠷ޙʹ
    ▶ lxc JP άϧʔϓ
    https://groups.google.com/forum/#!
    forum/lxc-jp

    ͷΜͼΓίϯςφͷ࿩Λ͢Δ৔ॴ
    ▶ lxc man pages ຋༁

    ຋༁ͷνΣοΫ͍͚ͯͨͩ͠Δํืू
    ▶ linuxcontainers.org ೔ຊޠϖʔδ
    ▶ News ຋༁ͷڠྗऀืू
    20

    View full-size slide

  21. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
    21

    View full-size slide