T4K Cleanup Plugin

tvk-cleanup is a kubectl plugin that uninstalls the Trilio Operator, Application, Custom Resources, and CRDs in a Kubernetes cluster.


  1. krew - kubectl-plugin manager. Install from here.

  2. kubectl - kubernetes command-line tool. Install from here.

For openshift environments, if kubectl is not installed and oc binary is installed on host machine, then oc binary can be used to perform kubectl operation by creating symlink with -

sudo ln -s /usr/local/bin/oc /usr/local/bin/kubectl
  • oc binary path can found by executing which oc

  • To delete/remove symbolic links use either unlink or rm command:

unlink /usr/local/bin/kubectl

Supported OS:

  • Linux

  • darwin

T4K Cleanup

This plugin cleans up all T4K Custom Resources, CRDs, and T4K application itself from all the namespace. It cleans up T4K installed as operator (on OCP platform) and as helm chart on upstream k8s (Rancher) cluster.

Please note the following:

  • Ensure kubectl utility is present on system

  • Ensure kubectl is pointed to k8s cluster (i.e can access the remote target cluster)

  • Ensure helm utility is present on system and pointed to the cluster

    • helmVersion=~v3 is needed on the cluster

  • Ensure minimum Kubernetes version >= 1.18.x

  • Cleans up all the Trilio Custom Resources, Trilio Manager application and CRDs from all the namespaces

  • User can select to delete any or all of

    1. Trilio Application (Operator or Helm chart)

    2. Trilio CRDs

    3. Trilio Customer Resources as listed here - Restore Backup Backupplan Hook Target Policy License

Installation, Upgrade, Removal of Plugins

With krew:

  • Add T4K custom plugin index of krew:

    kubectl krew index add tvk-plugins https://github.com/trilioData/tvk-plugins.git
  • Installation:

    kubectl krew install tvk-plugins/tvk-cleanup
  • Upgrade:

    kubectl krew upgrade tvk-cleanup
  • Removal:

    kubectl krew uninstall tvk-cleanup

Without krew:

  1. Choose a version of preflight plugin to install and check if release assets have preflight plugin's package[cleanup.tar.gz]

  2. Set env variable version=v1.x.x [update with your desired version]. If version is not exported, latest tagged version will be considered.


  • Bash or ZSH shells:

  set -ex; cd "$(mktemp -d)" &&
  if [[ -z ${version} ]]; then version=$(curl -s https://api.github.com/repos/trilioData/tvk-plugins/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'); fi &&
  echo "Installing version=${version}" &&
  curl -fsSLO "https://github.com/trilioData/tvk-plugins/releases/download/"${version}"/cleanup.tar.gz" &&
  tar zxvf cleanup.tar.gz && sudo mv cleanup/cleanup /usr/local/bin/kubectl-tvk_cleanup

Verify installation with kubectl tvk-cleanup --help




kubectl tvk-cleanup [options] [arguments]
        -h, --help                show brief help
        -n, --noninteractive      run script in non-interactive mode
        -c, --crd                 delete Trilio CRDs
        -t, --tvm                 delete Trilio Manager or Operator
        -r, --resources \"resource1 resource2..\"
                                  specify list of Trilio CRs to delete
                                  If not provided, all Trilio CRs (listed below) will be deleted
                                  e.g. Restore Backup Backupplan ClusterRestore ClusterBackup
                                       ClusterBackupPlan Hook Target Policy License


  • Interactive, Cleans up all:

kubectl tvk-cleanup -t -c -r
  • Non-interactive, Cleans up all:

kubectl tvk-cleanup -n -t -c -r
  • Non-interactive, Cleans up only Trilio Manager or Operator:

kubectl tvk-cleanup -n -t
  • Non-interactive, Cleans up only Trilio CRDs

kubectl tvk-cleanup -n -c
  • Non-interactive, Cleans up only specified Trilio CRs

kubectl tvk-cleanup -n -r "Restore Backup Backupplan"