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 --no-prompt
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 the cloud¶
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 the cloud¶
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.
If you also want to remove the MicroK8s cluster and free up all resources, first confirm that no namespaces are left over from the Juju models removed above (Juju creates one Kubernetes namespace per model):
sudo microk8s kubectl get namespaces
If you want to uninstall MicroK8s completely:
sudo snap remove microk8s --purge
Warning
Only remove MicroK8s if you’re not using it for other purposes. It may be hosting other workloads 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:
Deploy Charmed Apache Kafka on Kubernetes with the deployment guide.
Check out our other Charmed offerings from Canonical’s Data Platform team
Read about High Availability Best Practices
Report any problems you encountered.