Decommissioning
Decommissioning a cluster requires only a few commands, but beware that it will irretrievably destroy the cluster, its workloads and any information that was stored within. Before proceeding, it is important to verify that you:
- Have the correct details for the cluster you wish to decommission
- Have retrieved any valuable data from the cluster
Destroying the model
It is always preferable to use a new Juju model for each Kubernetes cluster. Removing the model is then a simple operation.
It is useful to list all the current models to make sure you are about to destroy the correct one:
This will list all the models running on the current controller, for example:
To proceed, use the juju destroy-model
command to target the model you wish to remove. For example:
You will see a warning, and be required to confirm the action. Juju will then continue to free up the resources, giving feedback on the process. It may take some minutes to complete depending on the size of the deployed model and the nature of the cloud it is running on.
WARNING! This command will destroy the "k8s-testing" model.
This includes all machines, applications, data and other resources.
Continue [y/N]? y
Destroying model
Waiting on model to be removed, 7 machine(s), 4 application(s)...
Waiting on model to be removed, 6 machine(s)...
...
Waiting on model to be removed, 3 machine(s)...
Waiting on model to be removed...
Model destroyed.
You should confirm that the cloud instances have been terminated with the relevant cloud console/utilities.
Destroying a controller
If there are no longer any cluster models attached to the controller, you may wish to remove the controller instance as well. This is performed with a similar command:
As previously, there is a confirmation step to make sure you wish to remove the controller.
The command will return an error if there are populated models still attached to the controller.
Removing/editing Kube config
If you have permanently removed clusters, it is also advisable to remove their entries in the Kubernetes configuration file (or remove the file entirely if you have removed all the clusters).
By default the file is located at ~/.kube/config
. It is a YAML format file, and each cluster block looks similar to this:
See the guide to contributing or discuss these docs in our public Mattermost channel.