Deletion
| Enterprise | ||||
|---|---|---|---|---|
| Available in these plans | Free | Dev | Prod | Scale |
| Auto Sleep | ||||
This feature is an Enterprise feature. See our pricing plans or contact our sales team for more information.
Accidental deletion of virtual clusters is something that can not be reverted. In order to prevent deletion of virtual clusters you can either set deletion.prevent or the loft.sh/non-deletable annotation to true.
If you want to delete this virtual cluster in the future, you need to either toggle deletion.prevent to false, remove the annotation in the YAML manifest or through the toggle in the UI.
Once you have done this, you can delete the virtual cluster as usual.
There are scenarios where it is desirable that virtual clusters are automatically deleted after a certain inactivity duration. This could be after firing up single-shot batch jobs or more generally not having to remember cleaning things up afterwards.
You can enable automatic deletion by configuring deletion.auto accordingly.
In order for auto deletion to work it requires an agent to be installed on the host cluster of the virtual cluster.
Configure​
- vcluster.yaml
- Platform UI
- Platform CRDs
Prevent deletion​
To prevent a virtual cluster from being deleted, add the following configuration to your vcluster.yaml:
deletion:
prevent: true
Deletion after inactivity​
To enable automatic deletion after a certain inactivity duration, add the following configuration to your vcluster.yaml:
deletion:
auto:
afterInactivity: 1m # Uses Go duration format
From the project drop-down menu (top left corner), select the project you'd like to create the virtual cluster in.
Click on Virtual Clusters.
Click on Edit on the virtual cluster that you want to edit.
Select the expander and toggle the Prevent Deletion slider accordingly or configure an inactivity duration (Sleep After Inactivity) for auto deletion.
Click on the button to save the changes.
You can prevent virtual cluster deletion, by setting the annotation loft.sh/non-deletable: "true" in the YAML manifest of the virtual cluster instance.
apiVersion: management.loft.sh/v1
kind: VirtualClusterInstance
metadata:
name: my-vcluster
annotations:
loft.sh/non-deletable: "true"
spec:
templateRef:
name: isolated-vcluster
clusterRef:
cluster: loft-clusterth