返回新闻概览

Incus 0.6 已发布

2024 年 2 月 23 日

简介

Incus 团队很高兴地宣布 Incus 0.6 发布!

2024 年的第二个版本包含许多改进,无论大小。

它提供了一个全新的集群用户存储驱动程序,支持存储桶的导入/导出,OVN 用户的许多改进,对新容器内核功能的支持,迁移工具的不少改进等等!

image|690x459

与往常一样,您可以在线尝试:https://linuxcontainers.cn/incus/try-it/

享受!

新功能

集群 LVM 存储驱动程序

添加了一个名为 lvmcluster 的新存储驱动程序。

顾名思义,这用于集群使用 LVM 存储驱动程序。
这依赖于 llvmlockd 和一个像 sanlock 这样的锁管理器来提供对整个集群的共享存储设备的并发访问。

这针对任何想要运行 Incus 集群并使用共享存储设备(如光纤通道 SAN、iSCSI 导出、NVMEoF/NVMEoTCP 磁盘……)的人。

随着能够在所有服务器上使用相同的存储,它支持更快的实时迁移、服务器疏散和在服务器突然死机时自动恢复的能力。

image|622x500

文档:https://linuxcontainers.cn/incus/docs/main/reference/storage_lvm/#lvmcluster-driver-in-incus

存储桶备份和导入

现在可以备份整个存储桶,然后重新导入回 Incus。

stgraber@dakara:~$ incus storage bucket create default foo
Storage bucket foo created
Admin access key: HD2GWC1KX693MFVT3P30
Admin secret key: tX9+G9G5UlcuT21yatKIUImSGvcXzPyA7ONgkjUv

stgraber@dakara:~$ dd if=/dev/random of=out.img bs=4M count=10
10+0 records in
10+0 records out
41943040 bytes (42 MB, 40 MiB) copied, 0.0975758 s, 430 MB/s
stgraber@dakara:~$ s3cmd --host=127.0.0.1:8445 --host-bucket=127.0.0.1:8445 --no-check-certificate --access_key=HD2GWC1KX693MFVT3P30 --secret_key=tX9+G9G5UlcuT21yatKIUImSGvcXzPyA7ONgkjUv put out.img s3://foo
upload: 'out.img' -> 's3://foo/out.img'  [part 1 of 3, 15MB] [1 of 1]
 15728640 of 15728640   100% in    0s   262.42 MB/s  done
upload: 'out.img' -> 's3://foo/out.img'  [part 2 of 3, 15MB] [1 of 1]
 15728640 of 15728640   100% in    0s   241.54 MB/s  done
upload: 'out.img' -> 's3://foo/out.img'  [part 3 of 3, 10MB] [1 of 1]
 10485760 of 10485760   100% in    0s   241.99 MB/s  done
stgraber@dakara:~$ s3cmd --host=127.0.0.1:8445 --host-bucket=127.0.0.1:8445 --no-check-certificate --access_key=HD2GWC1KX693MFVT3P30 --secret_key=tX9+G9G5UlcuT21yatKIUImSGvcXzPyA7ONgkjUv ls s3://foo
2024-02-23 03:26     41943040  s3://foo/out.img

stgraber@dakara:~$ incus storage bucket export default foo
Backup exported successfully!
stgraber@dakara:~$ incus storage bucket delete default foo
Storage bucket foo deleted

stgraber@dakara:~$ incus storage bucket import default backup.tar.gz
stgraber@dakara:~$ s3cmd --host=127.0.0.1:8445 --host-bucket=127.0.0.1:8445 --no-check-certificate --access_key=HD2GWC1KX693MFVT3P30 --secret_key=tX9+G9G5UlcuT21yatKIUImSGvcXzPyA7ONgkjUv ls s3://foo
2024-02-23 03:27     41943040  s3://foo/out.img

API:https://linuxcontainers.cn/incus/docs/main/rest-api-spec/#/storage/storage_pool_buckets_backups_post

列出所有项目中的镜像

就像使用 --all-projects 可以列出所有项目中的实例一样,现在也可以对镜像执行相同的操作。

stgraber@dakara:~$ incus image list --all-projects
+---------+-------+--------------+--------+------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| PROJECT | ALIAS | FINGERPRINT  | PUBLIC |               DESCRIPTION                | ARCHITECTURE |      TYPE       |   SIZE    |          UPLOAD DATE          |
+---------+-------+--------------+--------+------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| default |       | 256f59a72af5 | no     | Ubuntu jammy amd64 (20240222_07:42)      | x86_64       | VIRTUAL-MACHINE | 267.19MiB | Feb 23, 2024 at 12:27am (UTC) |
+---------+-------+--------------+--------+------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| default |       | 0941e441dbb9 | no     | Alpine edge amd64 (20240222_13:00)       | x86_64       | CONTAINER       | 2.93MiB   | Feb 23, 2024 at 12:27am (UTC) |
+---------+-------+--------------+--------+------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| default |       | d5fc6024f0fa | no     | Openwrt snapshot amd64 (20240222_11:57)  | x86_64       | CONTAINER       | 3.50MiB   | Feb 23, 2024 at 2:55am (UTC)  |
+---------+-------+--------------+--------+------------------------------------------+--------------+-----------------+-----------+-------------------------------+
| demo    |       | f44a6b4e56f4 | no     | Archlinux current amd64 (20240222_04:18) | x86_64       | CONTAINER       | 188.86MiB | Feb 23, 2024 at 3:32am (UTC)  |
+---------+-------+--------------+--------+------------------------------------------+--------------+-----------------+-----------+-------------------------------+

通过 API,这是通过传递 ?all-projects=true 来完成的。

非特权容器中的 binfmt_misc

Linux 6.7 添加了对在非特权容器内挂载 binfmt_misc 的支持。

Incus 0.6 将检测支持此功能的内核,如果支持,它将不再从主机系统绑定挂载 binfmt_misc,而是允许它从容器内挂载。

stgraber@castiana:~$ incus launch images:ubuntu/22.04 foo
Launching foo
stgraber@castiana:~$ incus exec foo bash
root@foo:~# uname -a
Linux foo 6.7.4-zabbly+ #debian12 SMP PREEMPT_DYNAMIC Mon Feb  5 23:37:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
root@foo:~# mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc/
root@foo:~# ls -lh /proc/sys/fs/binfmt_misc/
total 0
--w------- 1 root root 0 Feb 23 03:46 register
-rw-r--r-- 1 root root 0 Feb 23 03:46 status

binfmt_misc 文件系统用于为仿真定义自定义二进制格式。
它最著名的是由 qemu-user-static 用于运行其他架构的二进制文件。

对共享块存储卷的控制

引入了新的 security.shared 卷存储选项来控制是否允许自定义块卷被多个实例使用。

现在要求在将自定义块卷添加到配置文件之前设置该配置键,或者将其直接添加到多个虚拟机中。

stgraber@castiana:~$ incus config device add lvm01 shared disk pool=default source=shared-lvm io.bus=nvme
Device shared added to lvm01

stgraber@castiana:~$ incus config device add lvm02 shared disk pool=default source=shared-lvm io.bus=nvme
Error: Failed add validation for device "shared": Cannot add un-shared custom storage block volume to more than one instance

stgraber@castiana:~$ incus storage volume set default shared-lvm security.shared=true

stgraber@castiana:~$ incus config device add lvm02 shared disk pool=default source=shared-lvm io.bus=nvme
Device shared added to lvm02
stgraber@castiana:~$ incus config device add lvm03 shared disk pool=default source=shared-lvm io.bus=nvme
Device shared added to lvm03
stgraber@castiana:~$ incus start lvm01 lvm02 lvm03

网络信息中的 OVN 逻辑路由器名称

为了更轻松地了解 OVN 内部发生的事情,incus network info 现在将向您提供特定网络的逻辑路由器名称。

root@abydos:~# incus network info default
Name: default
MAC address: 00:16:3e:38:dd:28
MTU: 1500
State: up
Type: broadcast

IP addresses:
  inet  10.180.103.1/24 (link)
  inet6 2602:fc62:a:1004::1/64 (link)

Network usage:
  Bytes received: 0B
  Bytes sent: 0B
  Packets received: 0
  Packets sent: 0

OVN:
  Chassis: abydos
  Logical router: incus-net6-lr

镜像模板中的文件所有权和权限

模板文件现在可以在其上设置 uidgidmode
如果模板旨在成为可执行的 shell 脚本,这将特别有用。

stgraber@castiana:~$ incus config metadata show foo
architecture: amd64
creation_date: 1708588077
expiry_date: 1711180077
properties:
  architecture: amd64
  description: Ubuntu jammy amd64 (20240222_07:42)
  name: ubuntu-jammy-amd64-default-20240222_07:42
  os: ubuntu
  release: jammy
  serial: "20240222_07:42"
  variant: default
templates:
  /etc/hostname:
    when:
    - create
    - copy
    create_only: false
    template: hostname.tpl
    properties: {}
  /etc/hosts:
    when:
    - create
    - copy
    create_only: false
    template: hosts.tpl
    properties: {}
  /root/hello.sh:
    when:
    - start
    create_only: false
    template: hello.tpl
    properties: {}
    uid: "1000"
    gid: "2000"
    mode: "0755"

stgraber@castiana:~$ incus config template show foo hello.tpl
#!/bin/sh
echo "Hello world!"

stgraber@castiana:~$ incus start foo
stgraber@castiana:~$ incus exec foo bash
root@foo:~# ls -lh /root/hello.sh
-rwxr-xr-x 1 ubuntu 2000 30 Feb 23 04:07 /root/hello.sh
root@foo:~# /root/hello.sh
Hello world!

文档:https://linuxcontainers.cn/incus/docs/main/reference/image_format/#template-rules

加密的 EC 客户端证书密钥

对于那些与远程 Incus 服务器交互的人来说,您可能不知道可以使用密码来保护您的 Incus 私钥。

到目前为止,这只能对 RSA 密钥进行,但借助 Incus 0.6,我们现在也添加了对 EC 密钥的支持。由于 EC 密钥已经成为默认值一段时间了,因此这一点尤其重要。

文档:https://linuxcontainers.cn/incus/docs/main/authentication/#encrypting-local-keys

值得注意的是,如果使用此功能,您可能还需要使用最近引入的 "保持活动模式",因为这将显着减少您在使用 Incus 时出现的密码提示次数。

lxd-to-incus 改进

最后,lxd-to-incus 进行了许多改进。

  • 支持 Void Linux
  • 检测 boot.debug_edk2 配置键
  • 处理 OVN SSL 数据库连接
  • 在迁移期间自动清除 simplestreams 缓存

完整变更日志

以下是此版本中所有更改的完整列表。

完整提交列表
  • incusd/instance/qemu/qmp: 不要冒在弹出时阻塞 QMP 的风险
  • github: 切换到 minio deb 并固定工作版本
  • github: 使用稳定的 MicroCeph
  • incusd/db: 修复 CreateNetworkPeer 中的错误处理
  • incusd/apparmor: 允许在非特权容器中进行更多挂载
  • 使用 Weblate 翻译(巴西葡萄牙语)
  • incusd/instance/qemu/agent-loader: 处理旧的 lxd-agent-loader
  • incusd/device/disk: 在找不到 mkisofs 时使用 genisoimage
  • shared/api: 添加 NetworkStateOVN 中 Chassis 的示例
  • doc/rest-api: 刷新 swagger YAML
  • api: network_state_ovn_lr
  • shared/api: 添加 LogicalRouter 字段到 NetworkStateOVN
  • incusd/network/ovn: 暴露 LogicalRouter 名称
  • incus: 添加 OVN 逻辑路由器名称
  • i18n: 更新翻译模板
  • doc/rest-api: 刷新 swagger YAML
  • scripts/bash: 不要跟踪别名
  • 使用 Weblate 翻译(日语)
  • test: 将 test_database_no_disk_space() 适应到更新的 libraft 版本
  • incus/launch: 修复 --console
  • api: image_template_permissions
  • doc: 添加 uid/gid/mode 到镜像模板元数据
  • shared/api: 添加 owner/permission 字段到 ImageMetadataTemplate
  • doc/rest-api: 刷新 swagger YAML
  • incusd/instance/lxc: 添加对模板所有权/模式的支持
  • incus-agent: 添加对模板所有权/模式的支持
  • lxd-to-incus: 添加注释
  • lxd-to-incus: 添加缓存清理逻辑
  • .github: 将最低 Go 版本提升到 1.21
  • Makefile: 将最低 Go 版本提升到 1.21
  • gomod: 更新依赖项
  • doc: 将最低 Go 版本提升到 1.21
  • 使用 Weblate 翻译(法语)
  • incusd/daemon: 修复日志格式
  • incusd/sys: 排序内核功能
  • incusd/sys: 添加文档字符串
  • incusd/checkfeature: 添加非特权 binfmt 检测
  • incusd/sys: 添加 UnprivBinfmt
  • incusd/daemon: 检测非特权 binfmt_misc
  • incusd/api_1.0: 添加 unpriv_binfmt 内核功能
  • incusd/instance/lxc: 支持非特权 binfmt_misc
  • incusd/apparmor: 支持非特权 binfmt_misc
  • 使用 Weblate 翻译(意大利语)
  • completion: 支持返回非 Incus 远程
  • incus/image: 添加动态命令行补全
  • shared/cliconfig: 支持 SSH 加密密钥
  • tests: 添加 crypto/ssh
  • doc/remotes: 添加对保持活动的提及
  • doc: 添加 Ansible 到词典
  • doc/authentication: 加密客户端密钥的提示
  • api: images_all_projects
  • lxd-to-incus: 指示找到了哪些现有配置
  • shared/api: 添加项目属性到 Image
  • client: 添加 GetImagesAllProjects
  • incusd/images: 添加对 all_projects 的支持
  • doc/rest-api: 刷新 swagger YAML
  • incus/image: 添加 --all-projects 标志到列表
  • i18n: 更新翻译模板
  • shared/cliconfig: 修复静态分析
  • gomod: 更新依赖项
  • Makefile: 由于 OVN 问题,固定 rpc2 版本
  • incusd/instance/qemu: 重新排列代理 NIC 处理
  • incusd/instance/qemu/agent-loader: 处理 SELinux
  • incus/config: 添加补全
  • incus-agent: 在配置 NIC 之前加载 virtio_net
  • incus: 运行 gofmt
  • doc/storage/lvm: 清理表格
  • incusd/patches: 将 lvm.vg.force_reuse 移动到服务器特定位置
  • incusd/db: 将 lvm.vg.force_reuse 标记为服务器特定
  • doc/faq: 添加对 -mtu 网络接口的提及
  • incusd/device: 将基本 VM 文件系统卷提升到 500MiB
  • incusd/storage: 在空实例上创建 rootfs 目录
  • incusd/storage/quota: 不要在缺少项目时失败
  • incusd/instances: 在跨项目复制时使用正确的项目
  • incusd/patches: 修复错误的 SQL 查询
  • incusd/instances: 不要绕过实例限制检查
  • 使用 Weblate 添加翻译(葡萄牙语)
  • incus-agent: 重新排序导入
  • api: 添加 storage_bucket_backup 扩展
  • shared/api: 添加存储桶备份
  • incusd/db: 添加存储桶备份函数
  • incusd/db/operation: 添加存储卷备份类型
  • incusd/lifecycle: 添加存储桶备份事件
  • incusd/project: 添加 StorageBucket 函数
  • incusd/storage/s3: 添加传输管理器
  • incusd: 添加存储桶备份
  • client: 添加存储桶备份
  • incus: 添加存储桶导入/导出
  • doc/rest-api: 刷新 swagger YAML
  • i18n: 更新翻译模板
  • test: 添加存储桶备份
  • client: 删除特定于 ceph 的逻辑
  • incusd/storage/s3: 修复拼写错误
  • incus: 修复导入阴影
  • incus: 修复导出函数的注释
  • client: 修复导出函数的注释
  • incusd: 修复导入阴影
  • incusd: 修复导出函数的注释
  • incusd/cluster: 使远程存储卷逻辑通用
  • incusd/db: 不要硬编码远程存储驱动程序
  • incusd/storage_volumes: 不要硬编码 ceph
  • incusd/instances: 更新特定于 ceph 的注释
  • incusd/cluster: 更新特定于 ceph 的注释
  • incusd/instances: 通用化 Ceph 逻辑
  • lxd-to-incus: 支持 OVN 中的 SSL 身份验证
  • lxd-to-incus: 不要在缺少 OVN 网桥映射时失败
  • lxd-to-incus: 忽略 OVN 底盘 external_ids
  • lxd-to-incus: 将 boot.debug_edk2 添加到已弃用键
  • lxd-to-incus: 支持 Void Linux
  • cmd/incusd: 在 incus cp/mv 上禁用架构检查
  • incusd/instance: 在 incus cp/mv 上禁用架构检查
  • api: storage_lvm_cluster
  • incus/admin/init: 添加 LVM 集群逻辑
  • i18n: 更新翻译模板
  • lxd-to-incus: 添加 LVM 集群
  • doc: 添加 LVM 集群
  • shared/api: 添加 cephobject
  • shared/api: 添加 lvmcluster
  • doc/rest-api: 刷新 swagger YAML
  • incusd/storage/lvm: 添加集群 LVM
  • incusd/storage/lvm: 修复导入遮蔽
  • incusd/storage/lvm: 调整集群中的锁定
  • internal/server/device/config: 不要包含空值
  • internal/server/device/config: 修复 Update 函数的返回值
  • api: 添加 shared_custom_block_volumes API 扩展
  • doc/reference: 添加 security.shared 配置键
  • instance/server/device: 验证共享块设备
  • internal/server/storage: 处理 security.shared 更新
  • internal/server/storage: 允许自定义块卷使用 security.shared 键
  • internal/server/storage/drivers: 在 fillVolumeConfig 中处理 security.shared
  • incusd/instance/qemu: 将热插拔 CPU 插槽限制为 64 个
  • incusd/storage/lvm: 使 gofmt 满意
  • shared/subprocess: 改善错误处理
  • incusd/instance/qemu: 改善错误处理
  • incusd/network/ovs: 等待桥接接口出现
  • incusd/storage/zfs: 修复 VM 卷的刷新
  • internal/instance: 修复易失键定义
  • doc: 更新配置
  • incusd/network/ovn: 扩展 validateExternalSubnet 以允许上行链路子网
  • incusd/network/ovn: 将静态路由添加到负载均衡器和转发器
  • gomod: 更新依赖项

文档

Incus 文档可在以下网址找到
https://linuxcontainers.cn/incus/docs/main/

软件包

由于 Incus 上游仅发布常规发行版 tarball,因此没有官方的 Incus 软件包。以下是启动和运行 Incus 的一些可用选项。

在 Linux 上安装 Incus 服务器

Incus 可用于大多数常见的 Linux 发行版。您将在我们的文档中找到详细的安装说明。

https://linuxcontainers.cn/incus/docs/main/installing/

Incus 客户端的 Homebrew 软件包

客户端工具可通过 HomeBrew 在 Linux 和 MacOS 上使用。

https://formulae.brew.sh.cn/formula/incus

Incus 客户端的 Chocolatey 软件包

客户端工具可通过 Chocolatey 提供给 Windows 用户。

https://community.chocolatey.org/packages/incus/0.6

Incus 客户端的 Winget 软件包

客户端工具还可通过 Winget 提供给 Windows 用户。

https://winstall.app/apps/LinuxContainers.Incus

支持

在这个早期阶段,每个 Incus 版本只会被支持到下一个版本发布为止。这将在几个月后发生变化,因为我们计划发布一个 LTS 版本,与 LXC 和 LXCFS 的 LTS 版本同步。

社区支持可在以下网址获得:https://discuss.linuxcontainers.org
商业支持可通过以下网址获得:https://zabbly.com/incus
错误报告可在以下网址提交:https://github.com/lxc/incus/issues