Clean Up Rok Components

This guide will walk you through removing all Rok components from a Kubernetes cluster.

Note

If you have already cleaned up all Rok components, you may proceed to the Verify section.

Caution

Removing a Rok installation will permanently remove its state, including the metadata of all snapshots. You will not be able to restore these snapshots after removing Rok.

What You’ll Need

Check Your Environment

Before you remove the Rok components, ensure your management environment has access to your Kubernetes cluster. Verify that you can list the nodes of your cluster:

root@rok-tools:~# kubectl get nodes NAME STATUS ROLES AGE VERSION aks-agentpool-42574219-vmss000000 Ready agent 47h v1.22.12 aks-agentpool-42574219-vmss000001 Ready agent 47h v1.22.12 aks-workers-42574219-vmss000000 Ready agent 46h v1.22.12 aks-workers-42574219-vmss000001 Ready agent 46h v1.22.12 aks-workers-42574219-vmss000002 Ready agent 46h v1.22.12

Procedure

  1. Go to your GitOps repository, inside your rok-tools management environment:

    root@rok-tools:~# cd ~/ops/deployments
  2. Delete all Rok components and external services, including the PVCs holding their data:

    root@rok-tools:~/ops/deployments# rok-deploy --delete install/rok
  3. Delete all Rok Registry components and external services, including the PVCs holding their data:

    root@rok-tools:~/ops/deployments# rok-deploy --delete install/registry
  4. Delete your Istio installation:

    root@rok-tools:~/ops/deployments# rok-deploy --delete install/istio
  5. Restore the previous default storage class. Choose one of the following options, based on your cloud provider:

    root@rok-tools:~/ops/deployments# kubectl annotate storageclass gp2 \ > storageclass.kubernetes.io/is-default-class=true \ > --overwrite
    root@rok-tools:~/ops/deployments# kubectl annotate storageclass default \ > storageclass.kubernetes.io/is-default-class=true \ > --overwrite
    root@rok-tools:~/ops/deployments# kubectl annotate storageclass standard \ > storageclass.kubernetes.io/is-default-class=true \ > --overwrite
  6. Delete the Rok Monitoring Stack:

    root@rok-tools:~/ops/deployments# rok-deploy --delete rok/monitoring/overlays/deploy

Verify

  1. Ensure the RokCluster object no longer exists:

    root@rok-tools:~/ops/deployments# kubectl get RokCluster -A error: the server doesn't have a resource type "RokCluster"
  2. Ensure the following namespaces used by Rok components no longer exist:

    root@rok-tools:~/ops/deployments# kubectl get ns rok-system \ > rok-registry rok-registry-system istio-system monitoring Error from server (NotFound): namespaces "rok-system" not found Error from server (NotFound): namespaces "rok-registry" not found Error from server (NotFound): namespaces "rok-registry-system" not found Error from server (NotFound): namespaces "istio-system" not found Error from server (NotFound): namespaces "monitoring" not found
  3. Verify the Rok namespace has been cleaned up. Choose one of the following options, based on your cloud provider.

    1. Ensure the rok namespace no longer exists:

      root@rok-tools:~/ops/deployments# kubectl get ns rok Error from server (NotFound): namespaces "rok" not found
    1. Ensure there are no Pods running in the rok namespace:

      root@rok-tools:~/ops/deployments# kubectl get pods -n rok No resources found in rok namespace.
    2. Ensure there are no PVCs in the rok namespace:

      root@rok-tools:~/ops/deployments# kubectl get pvc -n rok No resources found in rok namespace.
    1. Ensure the rok namespace no longer exists:

      root@rok-tools:~/ops/deployments# kubectl get ns rok Error from server (NotFound): namespaces "rok" not found

Summary

You have successfully removed all Rok components and their PVCs from your Kubernetes cluster.

What’s Next

The next step is to clean up the snapshot data of Rok.