Chapter 9. Cleaning up data with support
MicroShift provides the microshift-cleanup-data
script for various troubleshooting tasks, such as deleting all data, certificates, and container images.
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
See the usage and list the available options of the
microshift-cleanup-data
script by entering the following command:WarningSome 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
Clean up all the MicroShift data and configuration by running the
microshift-cleanup-data
script with the--all
argument, by entering the following command:WarningThis option deletes all MicroShift data and user workloads. Use with caution.
$ sudo microshift-cleanup-data --all
TipThe 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
ImportantThe MicroShift service is stopped and disabled after you run the script.
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
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
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
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
ImportantThe MicroShift service is stopped and disabled after you run the script.
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
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
ImportantThe MicroShift service is stopped after you run the script.
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
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
ImportantThe MicroShift service is stopped after you run the script.
Restart the MicroShift service by running the following command:
$ sudo systemctl start microshift