Juju needs to know how to connect to clouds. The process of adding a cloud, consolidates information about the cloud’s endpoints and authentication requirements into a cloud definition file.
You don’t need to run this command if your cloud has out of the box support.
Adding clouds interactively
For new users, interactive mode is the recommended method for adding a cloud. This mode currently supports the following clouds: MAAS, Manual, OpenStack, Oracle, and vSphere.
To start the wizard, enter:
Adding clouds manually
More experienced Juju administrators can add their clouds manually. This can assist with automation.
Specific guides on manually adding a cloud can be found here:
Creating the YAML file
The manual method uses a YAML configuration file with the following format:
clouds: <cloud_name>: type: <cloud type> auth-types: [<authenticaton types>] regions: <region-name>: endpoint: <https://xxx.yyy.zzz:35574/v3.0/>
The table below shows the
authentication type available for each
cloud type. It does not include the
interactive type as it does not apply in the context of adding a cloud manually.
To add a cloud manually, we supply the path to the configuration as an argument:
juju add-cloud --local <cloud-name> -f <cloud-file>
In versions prior to
add-cloud command only operates locally (there is no
Managing multiple clouds with one controller
A cloud can be added to an existing controller, thereby saving a machine and the trouble of setting up a controller within that cloud.
For example, to manage a MAAS cloud with a LXD controller making the controller "multi-cloud:
juju bootstrap localhost lxd # Add MAAS cloud to the local client. juju add-cloud --local maas -f maas-cloud.yaml juju add-credential maas -f maas-credentials.yaml # Add the same MAAS cloud to the LXD controller. juju add-cloud --controller lxd maas
The output to the
list-clouds command becomes:
Clouds on controller "lxd": Cloud Regions Default Type Description localhost 1 localhost lxd maas 0 maas
A Kubernetes cluster can be added to an existing controller. Assuming you have a kube config with cluster credentials, adding a new controller cloud called “k8s-cloud” would be as simple as:
juju add-k8s k8s-cloud --controller lxd
And vice-versa, in a situation where services running on Kubernetes needed to interact with a stateful workload running on metal, a traditional cloud can be added to a controller running on Kubernetes.
juju bootstrap microk8s mk8s juju add-cloud maas -f maas-cloud.yaml --controller mk8s --force juju add-credential maas -f maas-credentials.yaml --controller mk8s
Both controller machine and workload machine(s) must be able to initiate a TCP connection to one another. There are also latency issues that may make some scenarios infeasible.
New cloud-based ‘add-model’ permissions can be set up via new commands
When adding a model on a multi-cloud controller specifying the cloud name is mandatory. To continue with the example above then, to add model ‘xanadu’ to the ‘maas’ cloud:
juju add-model xanadu maas