Openshift - 'oc' commands fail with "Unable to connect to the server: x509: certificate signed by unknown authority"
Asked Answered
T

2

6

After installing openshift locally, I can start minishift. on https://192.168.x.y:8443

When starting an 'oc' command, like 'oc project', then I get this error:

Unable to connect to the server: x509: certificate signed by unknown authority

When I start an 'oc' command without starting minishift, then I get this error:

Unable to connect to the server: dial tcp 192.168.x.y:8443: connectex: (Translated) Trying to connect failed because the connected party has not answered correctly after a certain time, or the established connection failed because the connected host did not answer.

Before: I could work with oc with Openshift online.

Tadzhik answered 1/6, 2018 at 18:22 Comment(0)
T
8

Solved, I guess a missing SSH issue.

After starting minimshift, perform a 'oc login' results in this meesage:

Authentication required for https://192.168.99.100:8443 (openshift)

So after providing the username and password, everything works find!

And of course, you can use the SSH tokens. You can find info by opening the Online Console > Question mark pulldown menu > command line.

Tadzhik answered 2/6, 2018 at 12:16 Comment(0)
D
0

If the certificate on the OpenShift master node is not signed by an external authority, you'd fail to login via API (as with oc login), and get error x509.

Try to pass a valid certificate file with --certificate-authority. For example, on RHEL it could be:

oc login https://api.your.ocp.cluster:6443 -u user -p '...' 
--certificate-authority /etc/pki/ca-trust/extracted/pem/tls-ca-bunddle.pem
Diacetylmorphine answered 25/8, 2022 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.