1台のノードに複数のcryoSPARCを稼働させるためにlibvirtでvmを複数作ったがリソース効率が微妙だったので incus のコンテナで複数のcryoSPARC masterノードを作ってみた
様相はこんな感じ

2026y03m04d_003414969.png

ホスト名ipアドレスストレージOS
rockylinux9.sybyl.local192.168.0.160/dev/sda(192G,system)
/dev/sdb(32G,cs)
Rocky Linux release 9.7

bridgeインターフェース

まず複数のコンテナを扱えるようにするためにnicをbridgeにします。このbridgeにコンテナが付く感じですね

[root@rockylinux9 ~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp6s18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether bc:24:11:46:92:95 brd ff:ff:ff:ff:ff:ff
 
[root@rockylinux9 ~]# nmcli conn
NAME     UUID                                  TYPE      DEVICE
enp6s18  8b4396b6-7fc4-3401-a679-148b8a9aa770  ethernet  enp6s18
lo       b177e43d-7d88-4344-bdf3-0fa4f75922e0  loopback  lo
 
[root@rockylinux9 ~]# nmcli conn add type bridge ifname br0 con-name br0
[root@rockylinux9 ~]# nmcli conn
NAME     UUID                                  TYPE      DEVICE
enp6s18  8b4396b6-7fc4-3401-a679-148b8a9aa770  ethernet  enp6s18
br0      47e93d7c-f2ec-4341-ab71-f05b7b891741  bridge    br0           <-- 削除は「nmcli con delete br0」
lo       b177e43d-7d88-4344-bdf3-0fa4f75922e0  loopback  lo
 
[root@rockylinux9 ~]# nmcli conn add type bridge-slave ifname enp6s18 master br0
[root@rockylinux9 ~]# nmcli conn
NAME                  UUID                                  TYPE      DEVICE
enp6s18               8b4396b6-7fc4-3401-a679-148b8a9aa770  ethernet  enp6s18
br0                   47e93d7c-f2ec-4341-ab71-f05b7b891741  bridge    br0
lo                    b177e43d-7d88-4344-bdf3-0fa4f75922e0  loopback  lo
bridge-slave-enp6s18  d92bc8f8-a168-4a0d-985f-8f495166cfdb  ethernet  --
 
[root@rockylinux9 ~]# nmcli conn modify br0 \
            bridge.stp no \
            ipv4.method manual ipv4.addresses "192.168.0.160/24" \
            ipv4.gateway "192.168.0.1" \
            ipv4.dns "192.168.0.3" \
            ipv4.dns-search "sybyl.local" \
            ipv4.never-default no \
            ipv6.method "disabled"
 
[root@rockylinux9 ~]# nmcli conn delete enp6s18 ; reboot
 
(reboot後)
[root@rockylinux9 ~]# nmcli conn
NAME                  UUID                                  TYPE      DEVICE
br0                   47e93d7c-f2ec-4341-ab71-f05b7b891741  bridge    br0
bridge-slave-enp6s18  d92bc8f8-a168-4a0d-985f-8f495166cfdb  ethernet  enp6s18
lo                    99c2d2cc-d1fc-437f-8dd0-37bf3d175e7c  loopback  lo
[root@rockylinux9 ~]#

incusサーバのnic構成が変更できないならmacvlanで行うが、ホストと直接通信ができないとかがある. まぁーbridgeでいいかな

incusサーバ構築

Incusと同様

[root@rockylinux9 ~]# cat /etc/redhat-release
Rocky Linux release 9.7 (Blue Onyx)
[root@rockylinux9 ~]# dnf copr enable neil/incus
[root@rockylinux9 ~]# dnf install epel-release
[root@rockylinux9 ~]# dnf config-manager --enable crb
[root@rockylinux9 ~]# dnf install incus incus-tools
 
[root@rockylinux9 ~]# systemctl enable incus --now

っでincusの初期設定

[root@rockylinux9 ~]# incus admin init
Would you like to use clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Name of the storage backend to use (dir, lvm, lvmcluster) [default=dir]:
Where should this storage pool store its data? [default=/var/lib/incus/storage-pools/default]:
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to use an existing bridge or host interface? (yes/no) [default=no]: no
Would you like the server to be available over the network? (yes/no) [default=no]: no
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: no
Would you like a YAML "init" preseed to be printed? (yes/no) [default=no]: no
[root@rockylinux9 ~]#

として「/var/lib/incus/storage-pools/default」にコンテナを置きます

incus管理者アカウントとユーザ名前空間の設定

incusのインストール時に用意される「incus-admin」に所属するユーザを作り incus管理者アカウントにします

[root@rockylinux9 ~]# useradd -s /bin/bash incus-supervisor
[root@rockylinux9 ~]# usermod -aG incus-admin incus-supervisor
[root@rockylinux9 ~]# id incus-supervisor
uid=1001(incus-supervisor) gid=1001(incus-supervisor) groups=1001(incus-supervisor),983(incus-admin)
[root@rockylinux9 ~]#

次に大事なのですが、incusコンテナで使用するアカウントのuid/gidを考えます。ホストのUID/GIDとコンテナのUID/GIDを融通させるには
特権コンテナにするか「raw.idmap」で融通させる必要がある
特権モードは単にコンテナに対して「incus config set <container> security.privileged true」とすれば外部もコンテナも同じUID/GIDが使えますが、セキュア的に良くないそうな.
ここでは「raw.idmap」を使います

ホストのアカウント「incus-supervisor」を作成したので既存のアカウントsaberと並び「/etc/subuid」と「/etc/subgid」は下記になります

[root@rockylinux9 ~]# cat /etc/subuid
saber:100000:65536
incus-supervisor:165536:65536
[root@rockylinux9 ~]# cat /etc/subgid
saber:100000:65536
incus-supervisor:165536:65536
[root@rockylinux9 ~]#

incusデーモンもこのsubuidを使うのでincus-supervisorの末尾(165536+65536= 231072)から65536のrootエントリーを加えます

[root@rockylinux9 ~]# echo "root:231072:65536" >> /etc/subuid
[root@rockylinux9 ~]# echo "root:231072:65536" >> /etc/subgid
 
[root@rockylinux9 ~]# systemctl restart incus  # 構成が変わったのでincusを再起動します

これはコンテナ内のUID:0が、ホスト側ではUID:165536に該当して、コンテナ内のUID:1000は、ホストのUID:166536に該当します。
なのでnfs側で 65536 より大きいUID/GIDの場合はこの /etc/subuid,subgid を修正するか、特権モードを使用します

コンテナの作成

コンテナを作成する際にprofileが読み込まれ作られます。初めからnicを用意するとか定義が出来るのですが、まずそのプロファイルの確認を行います

[incus-supervisor@rockylinux9 ~]$ incus profile list
To start your first container, try: incus launch images:ubuntu/22.04
Or for a virtual machine: incus launch images:ubuntu/22.04 --vm
 
+---------+-----------------------+---------+
|  NAME   |      DESCRIPTION      | USED BY |
+---------+-----------------------+---------+
| default | Default Incus profile | 0       |
+---------+-----------------------+---------+
[incus-supervisor@rockylinux9 ~]$ incus profile show default
config: {}
description: Default Incus profile
devices:
  root:
    path: /
    pool: default
    type: disk
name: default
used_by: []
project: default
[incus-supervisor@rockylinux9 ~]$

現在profileは1つあって、「default」という名称。中身はnicとかそんなのは付かず、プレーンな状態のコンテナを作るみたい
では「cs1」というrockylinux9なコンテナを作ってみます

[incus-supervisor@rockylinux9 ~]$ incus launch images:rockylinux/9 cs1 --profile default
Launching cs1
 
The instance you are starting doesn't have any network attached to it.
  To create a new network, use: incus network create
  To attach a network to an instance, use: incus network attach
 
[incus-supervisor@rockylinux9 ~]$
[incus-supervisor@rockylinux9 ~]$ incus list
+------+---------+------+------+-----------+-----------+
| NAME |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+------+---------+------+------+-----------+-----------+
| cs1  | RUNNING |      |      | CONTAINER | 0         |
+------+---------+------+------+-----------+-----------+
[incus-supervisor@rockylinux9 ~]$

っとコンテナ cs1 が出来ました

これでnicを付けて、ipを振ります

incus config device add cs1 eth0 nic nictype=bridged parent=br0
incus exec cs1 -- ip addr add 192.168.0.230/24 dev eth0
incus exec cs1 -- ip link set eth0 up
incus exec cs1 -- ip route add default via 192.168.0.1
incus exec cs1 -- sh -c 'echo "nameserver 192.168.0.1" > /etc/resolv.conf'

とコンテナの環境整備を行って、この段階で外部からパッケージを入れられる

incus exec cs1 -- bash
  dnf install bind-utils NetworkManager-tui openssh-server
  vi /etc/ssh/sshd_config
  systemctl enable sshd --now
  passwd root
  systemctl start NetworkManager --now
  nmtui
 
  groupadd -g 1000 gfo
  useradd -u 1000 -g 1000 -d /home/saber -s /bin/bash -m saber
最新の60件
2026-04-14 2026-04-13 2026-04-12 2026-04-08 2026-04-07 2026-04-06 2026-04-05 2026-04-04 2026-04-02 2026-03-26 2026-03-23 2026-03-21 2026-03-19 2026-03-15 2026-03-14 2026-03-13 2026-03-07 2026-03-06 2026-03-04 2026-03-02 2026-02-26 2026-02-24 2026-02-21 2026-02-18 2026-02-17 2026-02-16 2026-02-11 2026-02-09 2026-02-07 2026-02-06 2026-02-03 2026-02-02 2026-01-31 2026-01-26 2026-01-24 2026-01-18 2026-01-17 2026-01-12

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2026-03-04 (水) 04:59:21