Projects¶
LXD supports projects as a way to split your LXD server. Each project holds its own set of instances and may also have its own images and profiles.
What a project contains is defined through the features
configuration keys.
When a feature is disabled, the project inherits from the default
project.
By default all new projects get the entire feature set, on upgrade, existing projects do not get new features enabled.
The key/value configuration is namespaced with the following namespaces currently supported:
features
(What part of the project feature set is in use)limits
(Resource limits applied on containers and VMs belonging to the project)user
(free form key/value for user metadata)
Key |
Type |
Condition |
Default |
Description |
---|---|---|---|---|
|
string |
- |
- |
Compression algorithm to use for backups ( |
|
bool |
- |
|
Separate set of images and image aliases for the project |
|
bool |
- |
|
Separate set of networks for the project |
|
bool |
- |
|
Separate set of profiles for the project |
|
bool |
- |
|
Separate set of storage volumes for the project |
|
bool |
- |
- |
Whether to automatically update any image that LXD caches |
|
integer |
- |
- |
Interval in hours at which to look for update to cached images (0 disables it) |
|
string |
- |
- |
Compression algorithm to use for images ( |
|
string |
- |
- |
Default architecture which should be used in mixed architecture cluster |
|
integer |
- |
- |
Number of days after which an unused cached remote image will be flushed in the project |
|
integer |
- |
- |
Maximum number of containers that can be created in the project |
|
integer |
- |
- |
Maximum value for the sum of individual |
|
string |
- |
- |
Maximum value of aggregate disk space used by all instances volumes, custom volumes and images of the project |
|
integer |
- |
- |
Maximum number of total instances that can be created in the project |
|
string |
- |
- |
Maximum value for the sum of individual |
|
integer |
- |
- |
Maximum value for the number of networks this project can have |
|
integer |
- |
- |
Maximum value for the sum of individual |
|
integer |
- |
- |
Maximum number of VMs that can be created in the project |
|
bool |
- |
|
Block access to security-sensitive features (this must be enabled to allow the |
|
string |
- |
|
Prevents the creation of any instance or volume backups. |
|
string |
- |
- |
Prevents targeting cluster groups other than the provided ones. |
|
string |
- |
|
Prevents direct targeting of cluster members when creating or moving instances. |
|
string |
- |
|
Prevents use of low-level container options like |
|
string |
- |
|
Prevents setting |
|
string |
- |
|
If |
|
string |
- |
|
Prevents use for system call interception options. When set to |
|
string |
- |
|
If |
|
string |
- |
- |
If |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
|
If |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
|
Prevents use of devices of type |
|
string |
- |
- |
Specifies the allowed host UID ranges allowed in the instance |
|
string |
- |
- |
Specifies the allowed host GID ranges allowed in the instance |
|
string |
- |
- |
Comma-delimited list of network names that are allowed for use in this project. If not set, all networks are accessible (depending on the |
|
string |
- |
|
Comma-delimited list of network subnets from the uplink networks (in the form |
|
string |
- |
|
Comma-delimited list of network names that can be used as uplink for networks in this project |
|
string |
- |
|
Comma-delimited list of network zones that can be used (or something under them) in this project |
|
string |
- |
|
Prevents the creation of any instance or volume snapshots. |
|
string |
- |
|
Prevents use of low-level virtual-machine options like |
Those keys can be set using the lxc
tool with:
lxc project set <project> <key> <value>
Project limits¶
Note that to be able to set one of the limits.*
configuration keys, all instances
in the project must have that same configuration key defined, either directly or
via a profile.
In addition to that:
The
limits.cpu
configuration key also requires that CPU pinning is not used.The
limits.memory
configuration key must be set to an absolute value, not a percentage.
The limits.*
configuration keys defined on a project act as a hard upper bound for
the aggregate value of the individual limits.*
configuration keys defined on the
project’s instances, either directly or via profiles.
For example, setting the project’s limits.memory
configuration key to 50GB
means
that the sum of the individual values of all limits.memory
configuration keys defined
on the project’s instances will be kept under 50GB
. Trying to create or modify
an instance assigning it a limits.memory
value that would make the total sum
exceed 50GB
, will result in an error.
Similarly, setting the project’s limits.cpu
configuration key to 100
, means that
the sum of individual limits.cpu
values will be kept below 100
.
Project restrictions¶
If the restricted
configuration key is set to true
, then the instances of the
project won’t be able to access security-sensitive features, such as container
nesting, raw LXC configuration, etc.
The exact set of features that the restricted
configuration key blocks may grow
across LXD releases, as more features are added that are considered
security-sensitive.
Using the various restricted.*
sub-keys, it’s possible to pick individual
features which would be normally blocked by restricted
and allow them, so
they can be used by instances of the project.
For example:
lxc project set <project> restricted=true
lxc project set <project> restricted.containers.nesting=allow
will block all security-sensitive features except container nesting.
Each security-sensitive feature has an associated restricted.*
project configuration
sub-key whose default value needs to be explicitly changed if you want for that
feature to be allowed it in the project.
Note that changing the value of a specific restricted.*
configuration key has an
effect only if the top-level restricted
key itself is currently set to
true
. If restricted
is set to false
, changing a restricted.*
sub-key is
effectively a no-op.
Most 'restricted.*
configuration keys are binary switches that can be set to either
block
(the default) or allow
. However some of them support other values for
more fine-grained control.
Setting all restricted.*
keys to allow
is effectively equivalent to setting
restricted
itself to false
.