|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * support/troubleshooting/troubleshooting-operator-issues.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="olm-reinstall_{context}"] |
| 7 | += Reinstalling Operators after failed uninstallation |
| 8 | + |
| 9 | +You must successfully and completely uninstall an Operator prior to attempting to reinstall the same Operator. Failure to fully uninstall the Operator properly can leave resources, such as a project or namespace, stuck in a "Terminating" state and cause "error resolving resource" messages. For example: |
| 10 | + |
| 11 | +.Example `Project` resource description |
| 12 | +---- |
| 13 | +... |
| 14 | + message: 'Failed to delete all resource types, 1 remaining: Internal error occurred: |
| 15 | + error resolving resource' |
| 16 | +... |
| 17 | +---- |
| 18 | + |
| 19 | +These types of issues can prevent an Operator from being reinstalled successfully. |
| 20 | + |
| 21 | +[WARNING] |
| 22 | +==== |
| 23 | +Forced deletion of a namespace is not likely to resolve "Terminating" state issues and can lead to unstable or unpredictable cluster behavior, so it is better to try to find related resources that might be preventing the namespace from being deleted. For more information, see the link:https://access.redhat.com/solutions/4165791[Red Hat Knowledgebase Solution #4165791], paying careful attention to the cautions and warnings. |
| 24 | +==== |
| 25 | + |
| 26 | +The following procedure shows how to troubleshoot when an Operator cannot be reinstalled because an existing custom resource definition (CRD) from a previous installation of the Operator is preventing a related namespace from deleting successfully. |
| 27 | + |
| 28 | +.Procedure |
| 29 | + |
| 30 | +. Check if there are any namespaces related to the Operator that are stuck in "Terminating" state: |
| 31 | ++ |
| 32 | +[source,terminal] |
| 33 | +---- |
| 34 | +$ oc get namespaces |
| 35 | +---- |
| 36 | ++ |
| 37 | +.Example output |
| 38 | +---- |
| 39 | +operator-ns-1 Terminating |
| 40 | +---- |
| 41 | + |
| 42 | +. Check if there are any CRDs related to the Operator that are still present after the failed uninstallation: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +$ oc get crds |
| 47 | +---- |
| 48 | ++ |
| 49 | +[NOTE] |
| 50 | +==== |
| 51 | +CRDs are global cluster definitions; the actual custom resource (CR) instances related to the CRDs could be in other namespaces or be global cluster instances. |
| 52 | +==== |
| 53 | + |
| 54 | +. If there are any CRDs that you know were provided or managed by the Operator and that should have been deleted after uninstallation, delete the CRD: |
| 55 | ++ |
| 56 | +[source,terminal] |
| 57 | +---- |
| 58 | +$ oc delete crd <crd_name> |
| 59 | +---- |
| 60 | + |
| 61 | +. Check if there are any remaining CR instances related to the Operator that are still present after uninstallation, and if so, delete the CRs: |
| 62 | + |
| 63 | +.. The type of CRs to search for can be difficult to determine after uninstallation and can require knowing what CRDs the Operator manages. For example, if you are troubleshooting an uninstallation of the etcd Operator, which provides the `EtcdCluster` CRD, you can search for remaining `EtcdCluster` CRs in a namespace: |
| 64 | ++ |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +$ oc get EtcdCluster -n <namespace_name> |
| 68 | +---- |
| 69 | ++ |
| 70 | +Alternatively, you can search across all namespaces: |
| 71 | ++ |
| 72 | +[source,terminal] |
| 73 | +---- |
| 74 | +$ oc get EtcdCluster --all-namespaces |
| 75 | +---- |
| 76 | + |
| 77 | +.. If there are any remaining CRs that should be removed, delete the instances: |
| 78 | ++ |
| 79 | +[source,terminal] |
| 80 | +---- |
| 81 | +$ oc delete <cr_name> <cr_instance_name> -n <namespace_name> |
| 82 | +---- |
| 83 | + |
| 84 | +. Check that the namespace deletion has successfully resolved: |
| 85 | ++ |
| 86 | +[source,terminal] |
| 87 | +---- |
| 88 | +$ oc get namespace <namespace_name> |
| 89 | +---- |
| 90 | ++ |
| 91 | +[IMPORTANT] |
| 92 | +==== |
| 93 | +If the namespace or other Operator resources are still not uninstalled cleanly, contact Red Hat Support. |
| 94 | +==== |
| 95 | + |
| 96 | +. Reinstall the Operator using OperatorHub in the web console. |
| 97 | + |
| 98 | +.Verification |
| 99 | + |
| 100 | +* Check that the Operator has been reinstalled successfully: |
| 101 | ++ |
| 102 | +[source,terminal] |
| 103 | +---- |
| 104 | +$ oc get sub,csv,installplan -n <namespace> |
| 105 | +---- |
0 commit comments