Why switching between juju controllers is removing applications?

Hi all,

I am new to juju, I was following this great tutorial by @anton5mith :

After bootstrapping k8s to juju, I wanted to check if I could go back to the maas controller, but when I did the switch, it removed the applications ceph-mon and ceph-osd .

Is it an expected behavior?

❯ juju add-k8s my-k8s
This operation can be applied to both a copy on this client and to the one on a controller.
Do you want to add k8s cloud my-k8s to:
    1. client only (--client)
    2. controller "maas-cloud-default" only (--controller maas-cloud-default)
    3. both (--client --controller maas-cloud-default)
Enter your choice, or type Q|q to quit: 1

k8s substrate added as cloud "my-k8s" with storage provisioned
by the existing "ceph-xfs" storage class.
You can now bootstrap to this cloud by running 'juju bootstrap my-k8s'.
❯ juju bootstrap my-k8s
Creating Juju controller "my-k8s" on my-k8s
Bootstrap to generic Kubernetes cluster
Fetching Juju Dashboard 0.8.1
Creating k8s resources for controller "controller-my-k8s"
Downloading images
Starting controller pod
Bootstrap agent now started
Contacting Juju controller at to verify accessibility...

Bootstrap complete, controller "my-k8s" is now available in namespace "controller-my-k8s"

Now you can run
        juju add-model <model-name>
to create a new model to deploy k8s workloads.
❯ juju controllers
Use --refresh option with this command to see the latest information.

Controller          Model       User   Access     Cloud/Region        Models  Nodes    HA  Version
maas-cloud-default  default     admin  superuser  maas-cloud/default       2      1  none  2.9.26
my-k8s*             controller  admin  superuser  my-k8s                   1      1     -  2.9.26

❯ juju switch maas-cloud-default
juju remove-application ceph-mon ceph-osd
my-k8s:admin/controller -> maas-cloud-default:admin/default
removing application ceph-mon
removing application ceph-osd

So switch doesn’t remove the applications but you do have the line:

juju remove-application ceph-mon ceph-osd

I don’t know if this is an odd paste or some other reason why that command would have been run, but it was an explicit user request to remove those applications which Juju did based on user request.

1 Like

Thank you John for spotting this mistake… it is certainly a wrong copy paste on my side… Sorry for this.

1 Like