Chapter 9. Uninstalling OpenShift Container Platform
You can uninstall OpenShift Container Platform hosts in your cluster by running the uninstall.yml playbook. This playbook deletes OpenShift Container Platform content installed by Ansible, including:
- Configuration
- Containers
- Default templates and image streams
- Images
- RPM packages
The playbook deletes content for any hosts defined in the inventory file that you specify when running the playbook.
Before you uninstall your cluster, review the following list of scenarios and make sure that uninstalling is the best option:
- If your installation process failed and you want to continue the process, you can retry the installation. The installation playbooks are designed so that if they fail to install your cluster, you can run them again without needing to uninstall the cluster.
- If you want to restart a failed installation from the beginning, you can uninstall the OpenShift Container Platform hosts in your cluster by running the uninstall.yml playbook, as described in the following section. This playbook only uninstalls the OpenShift Container Platform assets for the most recent version that you installed.
- If you must change the host names or certificate names, you must recreate your certificates before retrying installation by running the uninstall.yml playbook. Running the installation playbooks again will not recreate the certificates.
- If you want to repurpose hosts that you installed OpenShift Container Platform on earlier, such as with a proof-of-concept installation, or want to install a different minor or asynchronous version of OpenShift Container Platform you must reimage the hosts before you use them in a production cluster. After you run the uninstall.yml playbooks, some host assets might remain in an altered state.
9.1. Uninstalling an OpenShift Container Platform cluster
To uninstall OpenShift Container Platform across all hosts in your cluster, change to the playbook directory and run the playbook using the inventory file you used most recently:
# ansible-playbook [-i /path/to/file] \ 1
/usr/share/ansible/openshift-ansible/playbooks/adhoc/uninstall.yml
- 1
- If your inventory file is not in the /etc/ansible/hosts directory, specify
-i
and the path to the inventory file.
9.2. Uninstalling nodes
To uninstall node components from specific hosts using the uninstall.yml playbook while leaving the remaining hosts and cluster alone:
Use this method only when attempting to uninstall specific node hosts, not specific masters or etcd hosts. Uninstalling master or etcd hosts requires more configuration changes in the cluster.
- Follow the steps in Deleting Nodes to remove the node object from the cluster.
Create a different inventory file that references only those hosts. For example, to delete content from only one node:
[OSEv3:children] nodes 1 [OSEv3:vars] ansible_ssh_user=root openshift_deployment_type=openshift-enterprise [nodes] node3.example.com openshift_node_group_name='node-config-infra' 2
Change to the playbook directory and run the uninstall.yml playbook:
# ansible-playbook -i /path/to/new/file \ 1 /usr/share/ansible/openshift-ansible/playbooks/adhoc/uninstall.yml
- 1
- Specify the path to the new inventory file.
When the playbook completes, all OpenShift Container Platform content is removed from the specified hosts.