How to clean a Rancher 2.x node

This document (000020162) is provided subject to the disclaimer at the end of this document.

Situation

Task

At times a node may need to be cleaned of all state to ensure it is consistent for further use in a cluster. This article and script are for Rancher 2.x.

Please note, this script will delete all containers, volumes, images, network interfaces, and directories that relate to Rancher and Kubernetes. It can also optionally flush all iptables rules. It is important to perform pre-checks, and backup the node as needed before proceeding with any steps below.

Pre-requisites

  • A node that needs cleaning, it should no longer be a member of any cluster.
  • A copy of the cleanup script, and root/sudo access.
  • Check the running containers or Pods, these will be forcefully deleted in the following steps.
  • Confirm you are on the correct node and are ready to proceed with cleaning all state.

Steps

The below steps use a script to automate the clean of a node, the commands used can be run manually as needed, follow the steps below for an automated approach to cleaning a node.

  • Login to the node, download the cleanup script:

curl -sLO https://github.com/rancherlabs/support-tools/raw/master/extended-rancher-2-cleanup/extended-cleanup-rancher2.sh

You should now have a copy of the script in the current directory.

  • Run the script:

sudo bash extended-cleanup-rancher2.sh

If desired, add a flush argument to also flush iptables rules.

sudo bash extended-cleanup-rancher2.sh flush

  • Restart the node

The node is now in a clean consistent state to be reused in a cluster.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020162
  • Creation Date: 06-May-2021
  • Modified Date:06-May-2021
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback@suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center