Problem removing a k8s model

Hello guys,

I’ve a problem with a model who doesn’t want to be removed.

I’ve built a K8s cluster based on charmed k8s and then I have added it to Juju :
juju add-k8s telco-k8s --controller $(juju switch | cut -d: -f1)

And then I created a model to operate my cluster :
juju add-model telco-k8s-juju-operator telco-k8s

But when I want to remove this last model everithing inside the model is destroyed but the model itself not and it returns me a timeout (even if use the --force and --no-wait option :

WARNING! This command will destroy the "telco-k8s-juju-operator telco-k8s" model.
This includes all containers, applications, data and other resources.

Continue [y/N]? y
Destroying model
Waiting for model to be removed.................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.................................................ERROR timeout after 30m0s timeout

Does anyone has already encountered this problem and knows how to delete this kind of model ?

Thanks in advance :slight_smile:
Samuel

Try : juju destroy-model telco-k8s --force -y

Juju asks k8s to delete the namespace hosing the model resources - sometimes this can take a long time to delete - kubectl shows the namespace as “Terminating”. It would be interesting to see if that is the case here.

Thanks for your answer,

I didn’t know that and I destroyed both models at “the same time”. I think the models containing the cluster has been destroyed before the namespace termination …

Do you know a way to bypass this (like for example deleting it “manually”) ? Or should I just resign myself to keep an empty model in the destroying state ?

Deleting the namespace manually will still likely take a long time - I have found that kubectl delete ns foo can take up to 10 or even 20 minutes to complete. That’s a k8s behaviour independent of Juju. Juju will not report that a model is fully destroyed until it sees that all relevant k8s resources are deleted. It if takes a while for k8s to do that, Juju can’t do much else other than wait.
I have not looked any further at this stage as to why k8s namespace deletion can take a while. I’m guessing it’s something like a persistent volume claim or other resource taking a while to be removed, while holds up the entire process.