Search

Chapter 9. Cleaning up data with support

download PDF

MicroShift provides the microshift-cleanup-data script for various troubleshooting tasks, such as deleting all data, certificates, and container images.

Warning

Do not run this script without the guidance of product Support. Contact Support by Submitting a support case.

9.1. Data cleanup script overview

You can see the usage and list available options of the microshift-cleanup-data script by running the script without arguments. Running the script without arguments does not delete any data or stop the MicroShift service.

Procedure

  1. See the usage and list the available options of the microshift-cleanup-data script by entering the following command:

    Warning

    Some of the options in the following script operations are destructive and can cause data loss. See the procedure of each argument for warnings.

    $ microshift-cleanup-data

    Example output

    Stop all MicroShift services, also cleaning their data
    
    Usage: microshift-cleanup-data <--all [--keep-images] | --ovn | --cert>
       --all         Clean all MicroShift and OVN data
       --keep-images Keep container images when cleaning all data
       --ovn         Clean OVN data only
       --cert        Clean certificates only

9.2. Cleaning all data and configuration

You can clean up all the MicroShift data and configuration by running the microshift-cleanup-data script.

When you run the script with the --all argument, you perform the following clean up actions:

  • Stop and disable all MicroShift services
  • Delete all MicroShift pods
  • Delete all container image storage
  • Reset network configuration
  • Delete the /var/lib/microshift data directory
  • Delete OVN-K networking configuration

Prerequisites

  • You are logged into MicroShift as an administrator with root-user access.
  • You have filed a support case.

Procedure

  1. Clean up all the MicroShift data and configuration by running the microshift-cleanup-data script with the --all argument, by entering the following command:

    Warning

    This option deletes all MicroShift data and user workloads. Use with caution.

    $ sudo microshift-cleanup-data --all
    Tip

    The script prompts you with a message to confirm the operation. Type 1 or Yes to continue. Any other entries cancel the clean up.

    Example output when you continue the clean up

    DATA LOSS WARNING: Do you wish to stop and clean ALL MicroShift data AND cri-o container workloads?
    1) Yes
    2) No
    #? 1
    Stopping MicroShift services
    Disabling MicroShift services
    Removing MicroShift pods
    Removing crio image storage
    Deleting the br-int interface
    Killing conmon, pause and OVN processes
    Removing MicroShift configuration
    Removing OVN configuration
    MicroShift service was stopped
    MicroShift service was disabled
    Cleanup succeeded

    Example output when you cancel the clean up

    DATA LOSS WARNING: Do you wish to stop and clean ALL MicroShift data AND cri-o container workloads?
    1) Yes
    2) No
    #? no
    Aborting cleanup

    Important

    The MicroShift service is stopped and disabled after you run the script.

  2. Restart the MicroShift service by running the following command:

    $ sudo systemctl enable --now microshift

9.3. Cleaning all data and keeping the container images

You can retain the MicroShift container images while cleaning all data by running the microshift-cleanup-data script with the --all and --keep-images arguments.

Keeping the container images helps speed up MicroShift restart after data clean up because the necessary container images are already present locally when you start the service.

When you run the script with the --all and --keep-images arguments, you perform the following clean up actions:

  • Stop and disable all MicroShift services
  • Delete all MicroShift pods
  • Reset network configuration
  • Delete the /var/lib/microshift data directory
  • Delete OVN-K networking configuration
Warning

This option deletes all MicroShift data and user workloads. Use with caution.

Prerequisites

  • You are logged into MicroShift as an administrator with root-user access.
  • You have filed a support case.

Procedure

  1. Clean up all data and user workloads while retaining the MicroShift container images by running the microshift-cleanup-data script with the --all and --keep-images argument, by entering the following command:

    $ sudo microshift-cleanup-data --all --keep-images

    Example output

    DATA LOSS WARNING: Do you wish to stop and clean ALL MicroShift data AND cri-o container workloads?
    1) Yes
    2) No
    #? Yes
    Stopping MicroShift services
    Disabling MicroShift services
    Removing MicroShift pods
    Deleting the br-int interface
    Killing conmon, pause and OVN processes
    Removing MicroShift configuration
    Removing OVN configuration
    MicroShift service was stopped
    MicroShift service was disabled
    Cleanup succeeded

  2. Verify that the container images are still present by running the following command:

    $ sudo crictl images | awk '{print $1}'

    Example output

    IMAGE
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    quay.io/openshift-release-dev/ocp-v4.0-art-dev
    registry.redhat.io/lvms4/topolvm-rhel9
    registry.redhat.io/openshift4/ose-csi-external-provisioner
    registry.redhat.io/openshift4/ose-csi-external-resizer
    registry.redhat.io/openshift4/ose-csi-livenessprobe
    registry.redhat.io/openshift4/ose-csi-node-driver-registrar
    registry.redhat.io/ubi9

    Important

    The MicroShift service is stopped and disabled after you run the script.

  3. Restart the MicroShift service by running the following command:

    $ sudo systemctl enable --now microshift

9.4. Cleaning the OVN-Kubernetes data

You can clean up the OVN-Kubernetes (ONV-K) data by running the microshift-cleanup-data script. Use the script to reset OVN-K network configurations.

When you run the script with the --ovn argument, you perform the following clean up actions:

  • Stop all MicroShift services
  • Delete all MicroShift pods
  • Delete OVN-K networking configuration

Prerequisites

  • You are logged into MicroShift as an administrator with root-user access.
  • You have filed a support case.

Procedure

  1. Clean up the OVN-K data by running the microshift-cleanup-data script with the --ovn argument, by entering the following command:

    $ sudo microshift-cleanup-data --ovn

    Example output

    Stopping MicroShift services
    Removing MicroShift pods
    Killing conmon, pause and OVN processes
    Removing OVN configuration
    MicroShift service was stopped
    Cleanup succeeded

    Important

    The MicroShift service is stopped after you run the script.

  2. Restart the MicroShift service by running the following command:

    $ sudo systemctl start microshift

9.5. Cleaning custom certificates data

You can use the microshift-cleanup-data script to reset MicroShift custom certificates so that they are recreated when the MicroShift service restarts.

When you run the script with the --cert argument, you perform the following clean up actions:

  • Stop all MicroShift services
  • Delete all MicroShift pods
  • Delete all MicroShift certificates

Prerequisites

  • You are logged into MicroShift as an administrator with root-user access.
  • You have filed a support case.

Procedure

  1. Clean up the MicroShift certificates by running the microshift-cleanup-data script with the --cert argument, by entering the following command:

    $ sudo microshift-cleanup-data --cert

    Example output

    Stopping MicroShift services
    Removing MicroShift pods
    Removing MicroShift certificates
    MicroShift service was stopped
    Cleanup succeeded

    Important

    The MicroShift service is stopped after you run the script.

  2. Restart the MicroShift service by running the following command:

    $ sudo systemctl start microshift
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.