LoginSignup
7
4

More than 5 years have passed since last update.

LXD/LXC 3.0.0がリリースされたので使ってみた

Last updated at Posted at 2018-04-03

はじめに

LXCとLXDの3.0.0がリリースされたので、早速インストールしてみます。

LXC v3.0.0
https://github.com/lxc/lxc/releases/tag/lxc-3.0.0
https://linuxcontainers.org/lxc/news/

LXD v3.0.0
https://github.com/lxc/lxd/releases/tag/lxd-3.0.0

環境

サーバ:さくらVPS メモリ2G
ホストOS:ubuntu 16.04

インストール

snapdを使用してLXDをインストールしていきます。
(※rootにログインして作業を行います)

root# apt install -y snapd
root# snap install lxd --channel=3.0

インストール結果

root# lxd --version
3.0.0
root# lxc --version
3.0.0

LXDセットアップ

cat <<EOF | lxd init --preseed
config: {}
networks:
- config:
    ipv4.address: auto
    ipv6.address: none
  description: ""
  managed: false
  name: lxdbr0
  type: ""
storage_pools:
- config:
    size: 15GB
  description: ""
  name: default
  driver: zfs
profiles:
- config: {}
  description: ""
  devices:
    eth0:
      name: eth0
      nictype: bridged
      parent: lxdbr0
      type: nic
    root:
      path: /
      pool: default
      type: disk
  name: default
EOF

コンテナ作成・起動

lxc launch ubuntu:16.04 first
root# lxc list
+-------+---------+---------------------+------+------------+-----------+
| NAME  |  STATE  |        IPV4         | IPV6 |    TYPE    | SNAPSHOTS |
+-------+---------+---------------------+------+------------+-----------+
| first | RUNNING | 10.13.81.144 (eth0) |      | PERSISTENT | 0         |
+-------+---------+---------------------+------+------------+-----------+

「first」が起動しました。

3.0.0で追加された機能

クラスタリング

※未検証(複数台用意して検証してみます)

物理サーバからLXDコンテナへの移行(lxd-p2c)

※未検証(移行元の物理サーバを適当に用意してやってみる予定)

lxc list でプロセス数カウント

zabbixなどの監視で使えそう……?

root# lxc list -c nsN
+-------+---------+-----------+
| NAME  |  STATE  | PROCESSES |
+-------+---------+-----------+
| first | RUNNING | 28        |
+-------+---------+-----------+

lxc storage info コマンドの追加

パット見でわかるように!

root# lxc storage info data
info:
  description: ""
  driver: zfs
  name: data
  space used: 310.16MB
  total space: 14.11GB
used by:
  containers:
  - first
  images:
  - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  profiles:
  - default

最後に

まだまだ3.0.0について調べきれていないので、随時追記していきます!

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4