Deleting StorageOS Objects

When a Kubernetes object is deleted, StorageOS controllers automatically sync this deletion to StorageOS. For example, when a Kubernets node is deleted, this will automatically be mirrored in StorageOS, likewise with Namespaces.

  1. Here is a StorageOS node, running on Kubernetes node worker1. A StorageOS node is any machine that is running the StorageOS daemonset pod. The node is visible below in kubectl.

    $ kubectl describe -n kube-system pod storageos-daemonset-6q4g8
    Name:                 storageos-daemonset-6q4g8
    Namespace:            kube-system
    Priority:             2000001000
    Priority Class Name:  system-node-critical
    Node:                 worker1/192.168.152.238
    Start Time:           Thu, 06 May 2021 15:53:34 +0100
    Labels:               app=storageos
                          app.kubernetes.io/component=storageos-daemonset
                          app.kubernetes.io/instance=example-storageos
                          app.kubernetes.io/managed-by=storageos-operator
                          app.kubernetes.io/name=storageos
                          app.kubernetes.io/part-of=storageos
                          controller-revision-hash=f5dcf577d
                          kind=daemonset
                          pod-template-generation=1
                          storageos_cr=example-storageos
    Annotations:          kubectl.kubernetes.io/default-logs-container: storageos
    Status:               Running
    IP:                   192.168.152.238
    ...
    

    The nodes in your cluster can be seen with storageos get nodes.

    $ storageos get nodes
    NAME          HEALTH  AGE        LABELS                              
    worker1       online  1 day ago  beta.kubernetes.io/arch=amd64,      
                                     beta.kubernetes.io/os=linux,        
                                     cattle.io/creator=norman,           
                                     kubernetes.io/arch=amd64,           
                                     kubernetes.io/hostname=worker1,
                                     kubernetes.io/os=linux,             
                                     node-role.kubernetes.io/worker=true
                                     storageos.com/computeonly=true 
    worker2       online  1 day ago  beta.kubernetes.io/arch=amd64,      
                                     beta.kubernetes.io/os=linux,        
                                     cattle.io/creator=norman,           
                                     kubernetes.io/arch=amd64,           
                                     kubernetes.io/hostname=worker2,
                                     kubernetes.io/os=linux,             
                                     node-role.kubernetes.io/worker=true 
    worker3       online  1 day ago  beta.kubernetes.io/arch=amd64,      
                                     beta.kubernetes.io/os=linux,        
                                     cattle.io/creator=norman,           
                                     kubernetes.io/arch=amd64,           
                                     kubernetes.io/hostname=worker3,
                                     kubernetes.io/os=linux,             
                                     node-role.kubernetes.io/worker=true
    ...
    
  2. Delete the node.

    $ kubectl delete node worker1
    
  3. Verify that the node has been deleted with kubectl get nodes or storageos get nodes. The node has now disappeared from StorageOS.

    $ storageos get nodes
    NAME          HEALTH  AGE        LABELS                              
    worker2       online  1 day ago  beta.kubernetes.io/arch=amd64,      
                                     beta.kubernetes.io/os=linux,        
                                     cattle.io/creator=norman,           
                                     kubernetes.io/arch=amd64,           
                                     kubernetes.io/hostname=worker2,
                                     kubernetes.io/os=linux,             
                                     node-role.kubernetes.io/worker=true 
    worker3       online  1 day ago  beta.kubernetes.io/arch=amd64,      
                                     beta.kubernetes.io/os=linux,        
                                     cattle.io/creator=norman,           
                                     kubernetes.io/arch=amd64,           
                                     kubernetes.io/hostname=worker3,
                                     kubernetes.io/os=linux,             
                                     node-role.kubernetes.io/worker=true 
    ...