Clean all data and keep 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.

  • You have filed a support case.

Procedure
  1. Clean up all data and user workloads when retaining the MicroShift container images by running 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-cleanup-data script stops and disables the MicroShift service.

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

    $ sudo systemctl enable --now microshift