8. Cleanup your environment

This is a part of the Charmed Apache Kafka Tutorial.

Remove tutorial

Caution

Removing a Juju model may result in data loss for all applications in this model.

To remove Charmed Apache Kafka and the tutorial model it is hosted on, along with all other applications:

juju destroy-model tutorial --destroy-storage --force

This will remove all applications in the tutorial model (Charmed Apache Kafka, OpenSearch, PostgreSQL). Your Juju controller and other models (if any) will remain intact for future use.

(Optional) Remove Juju and LXD

If you don’t need Juju anymore and want to free up additional resources on your machine, you can remove the Juju controller and Juju itself.

Caution

When you remove Juju as shown below, you lose access to any other applications you have hosted on Juju.

Remove the Juju controller

Check the list of controllers:

juju controllers

Remove the Juju controller created in this tutorial:

juju destroy-controller overlord

Remove Juju

To remove Juju altogether:

sudo snap remove juju --purge

Clean up LXD

If you also want to remove LXD containers and free up all resources:

List all remaining LXD containers:

lxc list

Delete unnecessary containers:

lxc delete <container-name> --force

If you want to uninstall LXD completely:

sudo snap remove lxd --purge

Warning

Only remove LXD if you’re not using it for other purposes. LXD may be managing other containers or VMs on your system.

What’s next?

In this tutorial, we’ve successfully deployed Apache Kafka, added/removed replicas, added/removed users to/from the cluster, and even enabled and disabled TLS. You may now keep your Charmed Apache Kafka deployment running or remove it entirely using the steps in Remove Charmed Apache Kafka and Juju. If you’re looking for what to do next you can: