Introduction
This guide provides step-by-step instructions for troubleshooting and resolving issues related to persistent volumes (PVs) in Charmed Kubernetes deployments. It covers scenarios where persistent volumes associated with a Kubernetes model need to be cleaned up after a failed or incomplete deployment.
Prerequisites
- A working Charmed Kubernetes deployment with Juju.
- Basic understanding of Kubernetes concepts.
Problem Description
After an unsuccessful deployment or cleanup attempt, lingering persistent volumes might cause issues in subsequent deployments. This guide addresses how to identify and resolve such problems.
Steps to Clean Up Persistent Volumes
Step 1: Check for Lingering PVs
kubectl get pv
Verify if there are any persistent volumes associated with the Charmed Kubernetes model.
Step 2: Delete Lingering PVs
If PVs are found, delete them using:
kubectl delete pv <pv-name>
Step 3: Forceful Model Deletion
If issues persist, attempt a forceful model deletion:
juju destroy-model <model-name> --force --destroy-storage --debug[tabs]
`
### Step 4: Verify Machine and Container
Identify the machine associated with the Charmed Kubernetes deployment:
juju machines
Access the machine using:
juju ssh
Verify running containers with:
lxc list
### Step 5: Stop and Delete Container
Stop and delete the Charmed Kubernetes container:
lxc stop lxc delete
### Step 6: Controller Cleanup
Try stopping the machine:
juju remove-machine --force
If unsuccessful, forcefully kill the machine.
### Step 7: Verify and Cleanup Controller
Check the network interfaces:
ifconfig
Identify and delete the LXC container associated with the Charmed Kubernetes cluster.
### Step 8: Final Model Cleanup
Ensure successful deletion of the Charmed Kubernetes model:
bashCopy code
juju destroy-model --force --destroy-storage --debug
### Step 9: Cleanup Localhost Controller
Attempt to destroy the localhost controller:
juju destroy-model localhost-localhost --force --destroy-storage --debug
Refresh models and retry if needed:
juju models
juju refresh
## Conclusion
This guide aims to resolve persistent volume-related issues in Charmed Kubernetes deployments. If problems persist, consider reaching out to the community or filing a bug report.