See also: remove-unit, How to manage units
juju add-unit [options] <application name>
Adds one or more units to a deployed application.
--debug (= false)
Equivalent to --show-log --logging-config==DEBUG
-h, --help (= false)
Show help on a command or other topic.
--logging-config (= "")
Specify log levels for modules
--quiet (= false)
Show no informational output
--show-log (= false)
If set, write the log file to stderr
--verbose (= false)
Show more verbose output
--attach-storage (= )
Existing storage to attach to the deployed unit (not available on k8s models)
-m, --model (= "")
Model to operate in. Accepts [:]|
-n, --num-units (= 1)
Number of units to add
--to (= "")
The machine and/or container to deploy the unit in (bypasses constraints)
add-unit is used to scale out an application for improved performance or
The usage of this command differs depending on whether it is being used on a k8s or cloud model.
Many charms will seamlessly support horizontal scaling while others may need an additional application support (e.g. a separate load balancer). See the documentation for specific charms to check how scale-out is supported.
For k8s models the only valid argument is -n,
Anything additional will result in an error.
Add five units of mysql:
juju add-unit mysql --num-units 5
For cloud models, by default, units are deployed to newly provisioned machines in accordance with any application or model constraints.
This command also supports the placement directive ("–to") for targeting specific machines or containers, which will bypass application and model constraints. --to accepts a comma-separated list of placement specifications (see examples below). If the length of this list is less than the number of units being added, the remaining units will be added in the default way (i.e. to new machines).
Add five units of mysql on five new machines:
juju add-unit mysql -n 5
Add a unit of mysql to machine 23 (which already exists):
juju add-unit mysql --to 23
Add two units of mysql to existing machines 3 and 4:
juju add-unit mysql -n 2 --to 3,4
Add three units of mysql, one to machine 3 and the others to new machines:
juju add-unit mysql -n 3 --to 3
Add a unit of mysql into a new LXD container on machine 7:
juju add-unit mysql --to lxd:7
Add two units of mysql into two new LXD containers on machine 7:
juju add-unit mysql -n 2 --to lxd:7,lxd:7
Add three units of mysql, one to a new LXD container on machine 7, and the others to new machines:
juju add-unit mysql -n 3 --to lxd:7
Add a unit of mysql to LXD container number 3 on machine 24:
juju add-unit mysql --to 24/lxd/3
Add a unit of mysql to LXD container on a new machine:
juju add-unit mysql --to lxd
Last updated 10 months ago.