vcluster
                                
                                
                                
                                    vcluster copied to clipboard
                            
                            
                            
                        keep-pvc option is not keeping the pvc inside vcluster
Hi, I think this is more like a feature request.
Currently, after I delete the vcluster by vcluster delete,  only the PVC of the vcluster itself can be retained, all other PVCs used inside the vcluster have been deleted, So after recreating the vcluster, my statefulset app can't go back to running state because it cannot bound the correct PV.
Thx for creating this magic suite, any response will be appreciated :)
@ericjee thanks for creating this issue! You can retain all objects by using the syncer flag (make sure you use the v0.5.0-alpha.7 version):
Create a values.yaml and then apply with vcluster create ... --upgrade -f values.yaml
syncer:
  extraArgs:
    - '--set-owner=false'
This will keep all objects the vcluster has created running including PVCs
@FabianKramm hi, I tried to set the option --set-owner=false in v0.5.0-alpha.7, After I delete vcluster, all objects inside vcluster are still alive, the status of all pods list in the lower cluster namespace is running, It's this normal behavior?
@ericjee Are you using reclaimPolicy: Retain on your storage class? That should instruct Kubernetes to not delete volumes unless you do that manually https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy
However some extra logic might be still needed to make sure that same resources are used after re-creating vcluster.
@ericjee Are you using
reclaimPolicy: Retainon your storage class? That should instruct Kubernetes to not delete volumes unless you do that manually https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policyHowever some extra logic might be still needed to make sure that same resources are used after re-creating vcluster.
Yes, I'm using Retain policy,  That's exactly what I want, I want objects(statefulsets) inside k3s can be terminated when I deleted vcluster, All objects inside k3s can be restored to its normal running state after I recreated vcluster with same volume.
@ericjee vcluster CLI has two commands that might work for your use case. Instead of deleting the vcluster you could pause it:
Usage:
  vcluster [command]
  ...
  pause       Pauses a virtual cluster
  resume      Resumes a virtual cluster
                                    
                                    
                                    
                                
@ericjee Do the vcluster pause and vcluster resume commands that I mentioned in the previous comment satisfy your use case?
Let us know if the suggestions from the previous two comments don't satisfy your use case, and I will reopen the issue if you are still interested in this feature.