How to log in to a controller

When a user registers a controller for the first time via juju register, details of the controller are added on the local system.

Consequently, the user (if a model is been assigned to him) can start deploying charms using such controller.

But how to use the same controller on other machines that have the juju client installed on?

We can use the juju login command.

Before we execute the command in the terminal, we must know:

  1. the controller’s ip address
  2. username and password of the user requesting the access to the controller

Note

The controller ip address can be public or private. If you are logging in to a controller not publicly exposed, be sure to turn the VPN on.

To know the controller’s ip address do the following:

  1. Access the machine on which the command juju register was executed
  2. In the terminal execute juju show-controller <controller_name>
  3. Take note of the first ip that responds (ping <ip>) among those available in the api-endpoints section

At this point we can execute the juju login command:

juju login -u <username> <controller_ip> -c <arbitrary_controller_name>

Note

The -c option adds the controller to the local machine with the specified name

This command will prompt a password request to log in to the controller.

Congratulations. You are now logged in to the controller!