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¶
- A configured management environment.
- An existing Kubernetes cluster.
- An existing Rok deployment.
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.18.19
aks-agentpool-42574219-vmss000001 Ready agent 47h v1.18.19
aks-workers-42574219-vmss000000 Ready agent 46h v1.18.19
aks-workers-42574219-vmss000001 Ready agent 46h v1.18.19
aks-workers-42574219-vmss000002 Ready agent 46h v1.18.19
Procedure¶
Go to your GitOps repository, inside your
rok-tools
management environment:root@rok-tools:~# cd ~/ops/deployments
Delete all Rok components and external services, including the PVCs holding their data:
root@rok-tools:~/ops/deployments# rok-deploy --delete install/rok
Delete all Rok Registry components and external services, including the PVCs holding their data:
root@rok-tools:~/ops/deployments# rok-deploy --delete install/registry
Delete your Istio installation:
root@rok-tools:~/ops/deployments# rok-deploy --delete install/istio
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
Delete the Rok Monitoring Stack:
root@rok-tools:~/ops/deployments# rok-deploy --delete rok/monitoring/overlays/deploy
Verify¶
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"
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
Verify the Rok namespace has been cleaned up. Choose one of the following options, based on your cloud provider.
Ensure the
rok
namespace no longer exists:root@rok-tools:~/ops/deployments# kubectl get ns rok Error from server (NotFound): namespaces "rok" not found
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.
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.
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.