Using OpenStack with Juju

Although Juju doesn't have baked-in knowledge of your OpenStack cloud, it does know how such clouds work in general. We just need to provide some information to add it to the list of known clouds.

Adding an OpenStack Cloud

Using the Juju add-cloud command, it is easy to add your OpenStack clouds to Juju's list of known clouds. The command is interactive, and will ask for a name, endpoint, authorisation method(s) and regions to use. (If you are unsure about endpoints and regions, they will be listed in the novarc file, if you have one for your OpenStack.) A sample session is shown below.

Running...

juju add-cloud

...will enter the interactive mode. Enter the desired values to continue.

Cloud Types
 maas
 manual
 openstack
 vsphere

Select cloud type: openstack

Enter a name for your openstack cloud: mystack

Enter the API endpoint url for the cloud: https://openstack.example.com:35574/v3.0/

Auth Types
 access-key
 userpass

Select one or more auth types separated by commas: access-key,userpass

Enter region name: dev1

Enter the API endpoint url for the region: https://openstack-dev.example.com:35574/v3.0/

Enter another region? (Y/n): n

Cloud "mystack" successfully added
You may bootstrap with 'juju bootstrap mystack'

Note that it is possible to choose more than one authorisation method - just separate the values with commas.

Once the cloud has been added, it will appear on the list of known clouds output by the juju clouds command. Note that the cloud name will be highlighted to indicate that it is a locally added cloud.

"juju cloud with locally added cloud"

It is also possible to define OpenStack clouds in a YAML formatted configuration file and register them with Juju. Please see the documentation for manually adding Openstack clouds for details.

Adding credentials

If you source a novarc file for OpenStack, or use the default environmental variables for accessing this cloud, you can simply get Juju to scan for the credentials and add them.

Run the command...

juju autoload-credentials

Juju will search known locations, including environment variables, for credential information and present you with a set of choices for storing them. Simply follow the prompts.

For other methods of adding credentials, please see the specific credentials documentation.

Images and private clouds

The above steps are all you need to use most OpenStack clouds which are configured for general use. If this is your own cloud, you will also need to additionally provide stream information so that the cloud can fetch the relevant images for Juju to use. This is covered in the section on private clouds.

Creating a controller

Once the image metadata has been gathered, either locally or via a registered and running Simplestream service, check your OpenStack networks. If there are multiple possible networks available to the cloud, it is also necessary to specify the network name or UUID for Juju to use to boot instances. Both the network name and UUID can be retrieved with the following command:

openstack network list

Choose the network you want the instances to boot from. You can use either the network name or the UUID with the 'network' configuration option when bootstrapping a new controller.

With the product-streams service running in your OpenStack Cloud, you are now ready to create a Juju controller:

juju bootstrap <cloud> <controller name> --config network=<network_id>

or if the simplestream data is local:

juju bootstrap <cloud> <controller name> --metadata-source ~/simplestreams/images --config network=<network_id>

For a detailed explanation and examples of the bootstrap command see the Creating a controller page.

Next steps

A controller is created with two models - the 'controller' model, which should be reserved for Juju's internal operations, and a model named 'default', which can be used for deploying user workloads.

See these pages for ideas on what to do next:

© 2018 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.