Uninstall the StackRox Kubernetes Security Platform

Use this guide to uninstall each component of the StackRox Kubernetes Security Platform.

1 minute read

When you install the StackRox Kubernetes Security Platform, it creates:

  • a namespace called stackrox and installs the StackRox Kubernetes Security Platform and its components in that namespace
  • PodSecurityPolicy and Kubernetes Role-Based Access Control (RBAC) objects for all components
  • additional labels on namespaces, for use in generated network policies
  • an Application CRD (if it doesn’t exist)

To uninstall the StackRox Kubernetes Security Platform and remove all its components, run the following commands:

  1. Delete the stackrox namespace:

    Copy
    kubectl delete namespace stackrox
    Copy
    oc delete namespace stackrox
  2. Delete global resources:

    Copy
    kubectl -n stackrox get clusterrole,clusterrolebinding,role,rolebinding,psp -o name | grep stackrox | xargs kubectl -n stackrox delete --wait
    Copy
    oc -n stackrox get clusterrole,clusterrolebinding,role,rolebinding,psp -o name | grep stackrox | xargs oc -n stackrox delete --wait
    oc delete scc -l "app.kubernetes.io/name=stackrox"
  3. Delete labels and annotations:

    Copy
    for namespace in $(kubectl get ns | tail -n +2 | awk '{print $1}'); do
      kubectl label namespace $namespace namespace.metadata.stackrox.io/id-;
      kubectl label namespace $namespace namespace.metadata.stackrox.io/name-;
      kubectl annotate namespace $namespace modified-by.stackrox.io/namespace-label-patcher-;
    done
    Copy
    for namespace in $(oc get ns | tail -n +2 | awk '{print $1}'); do
      oc label namespace $namespace namespace.metadata.stackrox.io/id-;
      oc label namespace $namespace namespace.metadata.stackrox.io/name-;
      oc annotate namespace $namespace modified-by.stackrox.io/namespace-label-patcher-;
    done

Questions?

We're happy to help! Reach out to us to discuss questions, issues, or feature requests.

© 2021 StackRox Inc. All rights reserved.