Unable to connect to the server: EOF - never ending certification approvals
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 4
Issue
- Users get error
Unable to connect to the server: EOFwhileoc login. - CSR getting generated every 10 minutes
- As soon as certificates are approved, new ones are issued within a couple of minutes.
Resolution
-
While
oc logindoes not work, the first step here would be to connect tomasternodes usingsshand getting access tooccommand as per the steps mentioned in the article. -
Once the access is available to
occommand, clean up all CSRs.$ oc delete csr --all -
Delete the bad certificate
$ oc delete secret -n openshift-config-managed kube-controller-manager-client-cert-key -
Then approve the
CSRsas they come in and verify that they are now "Approved,Issued"$ oc get csr -o name | xargs oc adm certificate approve $ oc get csr -A -
If
etcdandkube-scheduleris broken patch them.$ oc patch etcd cluster -p='{"spec": {"forceRedeploymentReason": "recovery-'"$( date --rfc-3339=ns )"'"}}' --type=merge$ oc patch kubescheduler cluster -p='{"spec": {"forceRedeploymentReason": "recovery-'"$( date --rfc-3339=ns )"'"}}' --type=merge
Root Cause
- Certificate is either
expiredorcorrupt. kube-controller-managermight be broken due to whichcsrwas not getting "Approved, Issued".etcdandkube-schedulerpod having some issue.
Diagnostic Steps
-
Check the pending CSR.
$ oc get CSR -A -
Check the
kube-controller-managerlogs.2022-06-27T06:33:31.318347695Z E0627 06:33:31.318207 1 leaderelection.go:330] error retrieving resource lock kube-system/kube-controller-manager: Unauthorized 2022-06-27T06:33:36.359141076Z E0627 06:33:36.359093 1 leaderelection.go:330] error retrieving resource lock kube-system/kube-controller-manager: Unauthorized 2022-06-27T06:33:41.798588413Z E0627 06:33:41.798549 1 leaderelection.go:330] error retrieving resource lock kube-system/kube-controller-manager: Unauthorized -
Check the
ETCDpods health$ oc get pods -n openshift-etcd
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.