How to configure a model

See also: Configuration, List of model configuration keys

This document demonstrates how to get and set model configuration values.

A model’s configuration influences all the machines residing within it and, in turn, the applications that get deployed onto those machines.


Get values

See also: model-config, model-defaults

To get the current model configuration, use the model-config command, as shown below. This will show all the currently set key values—whether they were set by you, inherited as a default value, or dynamically set by Juju.

juju model-config

You can also see a list of all the default model configuration values. For this, use the model-defaults command, as shown below.

juju model-defaults

Set values

During controller creation

See also: juju bootstrap --config ..., juju bootstrap --model-default ..., How to create a controller

The first chance to set model configuration keys is during controller creation, via the bootstrap command plus an option—either --config or --model-default followed by a key-value pair. The difference is that --config affects just the ‘controller’ and ‘default’ models while --model-default affects all models, including any future ones. For example:

juju bootstrap --config image-stream=daily localhost lxd-daily

To pass multiple key-value pairs, repeat --config or --model-default for every pair. For example:

juju bootstrap microk8s uk8s \
  --model-default logging-config="<root>=WARNING; unit=DEBUG" \
  --model-default update-status-hook-interval="60m"

After controller creation

You can also set model configuration(s / defaults) after controller creation. This can happen during model creation or after model creation.

During model creation

See also: add-model --config

To configure a model while adding it, use the add-model command with the --config option. You can pass the key-value pair(s) directly or via a YAML file. The example below illustrates both:

juju add-model mymodel --config my-config.yaml --config image-stream=daily

After model creation

See also: model-config ..., model-config --reset ..., model-defaults ...

To configure a model after you’ve already added it, you can set a value by using juju model-config followed by the relevant key-value pair:

juju model-config

It is also possible to specify a list of key-value pairs:

juju model-config test-mode=true enable-os-upgrade=false

And you can also specify a YAML file containing a list of key-value pairs:

juju model-config more-config-values.yaml

Juju does not currently check that the provided key is a valid setting, so make sure you spell it correctly.

You can also set a null value:

juju model-config apt-mirror=""

To return a value to the default setting, use the --reset flag followed by the key name:

juju model-config --reset test-mode

You can also set default values that all new models will use. These values can even be specified for each cloud region instead of just the controller. For example, to set a default value for ‘ftp-proxy’, do:

juju model-defaults ftp-proxy=

While doing this, you can also specify a controller region:

juju model-defaults us-east-1 test-mode=true enable-os-upgrade=false

And you can also pass the key-value pairs from a YAML file:

juju model-defaults more-default-config-values.yaml

These defaults can be overridden, on a per-model basis, during the invocation of the add-model command (option --config) as well as by resetting specific options to their original defaults through the use of the model-config command (option --reset).

Last updated 4 months ago.