How to resolve the Openshift Project Stuck in Terminating State and Failed to Delete Issue.

By | May 9, 2020

One of the Issues you may face after redeploying the SSL certificate or after any of the major change on OpenShift v3.11 cluster is related to the termination of any project. If the project is not getting terminated and it gets stuck then this may happen because the api-resources (api metrics server) is not running properly. This could be one of the possibilities.

 # oc api-resources 

error: unable to retrieve the complete list of server APIs: the server is currently unable to handle the request


error: unable to retrieve the complete list of server APIs: Unauthorized

$ oc get pod -n openshift-metrics-server
$ oc get apiservices

Note: If the output of # oc get apiservices shows the running services then you may need to delete the service and rerun the playbook. or else directly execute the playbook

 $ oc delete apiservice 

API metrics server has an issue resulting in which the api-resources can not be retrieved, In order to fix these issues you need to redeploy the API metrics server. Execute the below playbook to do so.

$ ansible-playbook -i inventory_file /usr/share/ansible/openshift-ansible/playbooks/metrics-server/config.yml -e openshift_metrics_server_install=true

One API metrics server is redeployed, Just verify the api-resources

$ oc get apiservices | grep -i metrics
$ oc api-resources

Now check the project which was stuck in terminating state, It should probably be gone.

Leave a Reply

Your email address will not be published. Required fields are marked *