Removing the primary node

Removing the primary node refers to the removal of the initial (bootstrap) node.

Warning: Removing the primary node will destroy the entire MicroStack deployment.

If the deployment consists of multiple nodes then remove all non-primary nodes before removing the primary node. See page Scaling down the cluster for instructions on doing that.

Remove components from the node

Software components need to removed from the node. Perform all the below steps on the primary node.

Remove the Juju model:

juju destroy-model --destroy-storage --no-prompt --force --no-wait openstack

Remove the Juju controller:

juju destroy-controller --no-prompt --destroy-storage  --force --no-wait sunbeam-controller

Remove the Juju agent:

sudo /sbin/remove-juju-services

Remove the juju snap:

sudo snap remove --purge juju

Remove Juju configuration:

rm -rf ~/.local/share/juju
sudo rm -rf /var/lib/juju/dqlite
sudo rm -rf /var/lib/juju/system-identity
sudo rm -rf /var/lib/juju/bootstrap-params

Remove the openstack-hypervisor and openstack snaps:

sudo snap remove --purge openstack-hypervisor
sudo snap remove --purge openstack

Remove openstack snap configuration:

rm -rf ~/.local/share/openstack

Remove k8s snap:

sudo k8s remove-node
sudo snap remove --purge k8s

The above steps can take a few minutes to complete.

Remove the microceph snap:

sudo microceph disk list
sudo snap remove --purge microceph

If required clean the disk(s) identified in the earlier command:

sudo dd if=/dev/zero of=<DISK PATH> bs=4M count=10

Caution: The dd command will result in the permanent erasure of data. It is vital that you have specified the correct disk path to avoid unintended data loss.

Clear the remaining network configuration with a reboot:

sudo reboot
1 Like

Can we add steps to clean disks used in microceph?
Can we add steps to remove juju and clean ~/.local/share/juju

Thanks @hemanth-n, I’ve updated the guide

It seems the removal of sudo rm -rf /var/lib/juju/ after the removal of juju is also needed, otherwise you might get when installing again/left over DBs
2023-11-23 13:25:54 INFO juju.cmd.jujud bootstrap.go:500 started mongo ERROR creating controller database schema: table lease_type already exists

Nevermind, it seems ```
sudo /sbin/remove-juju-services

is removing it

I think snap remove should contain also --purge

$ sudo snap saved
Set  Snap       Age    Version  Rev    Size    Notes
1    juju       7m28s  3.4.1    26895    550B  auto
2    openstack  7m08s  2023.2   456    67.4MB  auto
3    microk8s   5m06s  v1.28.7  6532   3.80GB  auto

I agree. The document has been updated accordingly.

For the ‘openstack’ snap 2023.2/stable after following the steps above, one must also run the following to be able to successfully bootstrap juju again:

sudo rm -rf /var/lib/juju/agents
sudo rm -rf /var/lib/juju/dqlite
sudo rm -rf /var/lib/juju/system-identity
sudo rm -rf /var/lib/juju/bootstrap-params

I posted a bit more details in this LP Bug comment: Comment #7 : Bug #2024486 : Bugs : OpenStack Snap

Thanks. I added this to the document.