LXD¶
LXD can be configured using lxd init
(and optionally, lxd bridge
. If
LXD configuration is provided, it will be installed on the system if it is not
already present.
For a full list of keys, refer to the LXD module schema.
Minimal configuration¶
The simplest working configuration of LXD, with a directory backend, is as follows:
1#cloud-config
2lxd:
3 init:
4 storage_backend: dir
Config options showcase¶
This example shows a fuller configuration example, showcasing many of the LXD options. For a more complete list of the config options available, refer to the LXD module docs. If an option is not specified, it will default to “none”.
1#cloud-config
2lxd:
3 init:
4 network_address: 0.0.0.0
5 network_port: 8443
6 storage_backend: zfs
7 storage_pool: datapool
8 storage_create_loop: 10
9 bridge:
10 mode: new
11 mtu: 1500
12 name: lxdbr0
13 ipv4_address: 10.0.8.1
14 ipv4_netmask: 24
15 ipv4_dhcp_first: 10.0.8.2
16 ipv4_dhcp_last: 10.0.8.3
17 ipv4_dhcp_leases: 250
18 ipv4_nat: true
19 ipv6_address: fd98:9e0:3744::1
20 ipv6_netmask: 64
21 ipv6_nat: true
22 domain: lxd
Advanced configuration¶
For more complex, non-interactive LXD configuration of networks, storage pools,
profiles, projects, clusters and core config, lxd:preseed
config will be
passed as stdin to the command:
lxd init --preseed
See the non-interactive LXD configuration documentation, or run
lxd init --dump
to see the viable preseed YAML allowed.
Preseed settings configure the LXD daemon to listen for HTTPS connections on
192.168.1.1
port 9999, a nested profile which allows for LXD nesting on
containers, and a limited project allowing for RBAC approach when defining
behavior for sub-projects.
1#cloud-config
2lxd:
3 preseed: |
4 config:
5 core.https_address: 192.168.1.1:9999
6 networks:
7 - config:
8 ipv4.address: 10.42.42.1/24
9 ipv4.nat: true
10 ipv6.address: fd42:4242:4242:4242::1/64
11 ipv6.nat: true
12 description: ""
13 name: lxdbr0
14 type: bridge
15 project: default
16 storage_pools:
17 - config:
18 size: 5GiB
19 source: /var/snap/lxd/common/lxd/disks/default.img
20 description: ""
21 name: default
22 driver: zfs
23 profiles:
24 - config: {}
25 description: Default LXD profile
26 devices:
27 eth0:
28 name: eth0
29 network: lxdbr0
30 type: nic
31 root:
32 path: /
33 pool: default
34 type: disk
35 name: default
36 - config: {}
37 security.nesting: true
38 devices:
39 eth0:
40 name: eth0
41 network: lxdbr0
42 type: nic
43 root:
44 path: /
45 pool: default
46 type: disk
47 name: nested
48 projects:
49 - config:
50 features.images: true
51 features.networks: true
52 features.profiles: true
53 features.storage.volumes: true
54 description: Default LXD project
55 name: default
56 - config:
57 features.images: false
58 features.networks: true
59 features.profiles: false
60 features.storage.volumes: false
61 description: Limited Access LXD project
62 name: limited