2

我正在尝试登录入门 openshift 服务器。然后得到错误:

C:\Users\Admin>oc login https://console-openshift-console.apps.us-west-1.online-starter.openshift.com
error: invalid character '<' looking for beginning of value

CLI 版本:

C:\Users\Admin>oc version
Client Version: version.Info{Major:"4", Minor:"1+", GitVersion:"v4.1.1", GitCommit:"4b47d3394", GitTreeState:"clean", BuildDate:"2019-06-05T20:42:01Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"windows/amd64"}

Openshift 4在线“关于”:Kubernetes Master Version v1.13.4+81fc896

错误的完整堆栈跟踪:

C:\Users\Admin>oc login https://console-openshift-console.apps.us-west-1.online-starter.openshift.com --loglevel=9
I0610 15:30:13.242674    6768 round_trippers.go:419] curl -k -v -XHEAD  'https://console-openshift-console.apps.us-west-1.online-starter.openshift.com:443/'
I0610 15:30:14.731741    6768 round_trippers.go:438] HEAD https://console-openshift-console.apps.us-west-1.online-starter.openshift.com:443/ 200 OK in 1459 milliseconds
I0610 15:30:14.741867    6768 round_trippers.go:444] Response Headers:
I0610 15:30:14.742863    6768 round_trippers.go:447]     Date: Mon, 10 Jun 2019 12:30:14 GMT
I0610 15:30:14.742863    6768 round_trippers.go:447]     Content-Type: text/html; charset=utf-8
I0610 15:30:14.743861    6768 round_trippers.go:447]     Cache-Control: private
I0610 15:30:14.743861    6768 round_trippers.go:447]     X-Content-Type-Options: nosniff
I0610 15:30:14.744858    6768 round_trippers.go:447]     Set-Cookie: csrf-token=Y5HTi5JEtyltd27b7VgaS3tC0jpkYk2WWHqibPSa4tRsh0TJgt0k6fzfZdQTZMawO0rLB6nLNINqNmYTAtqUPQ==; Path=/; Secure
I0610 15:30:14.744858    6768 round_trippers.go:447]     Set-Cookie: 1e2670d92730b515ce3a1bb65da45062=c13f251446e70d52cfdceee5ed73bcbb; path=/; HttpOnly; Secure
I0610 15:30:14.744858    6768 round_trippers.go:447]     X-Dns-Prefetch-Control: off
I0610 15:30:14.745855    6768 round_trippers.go:447]     X-Frame-Options: DENY
I0610 15:30:14.745855    6768 round_trippers.go:447]     X-Xss-Protection: 1; mode=block
I0610 15:30:14.745855    6768 round_trippers.go:447]     Referrer-Policy: strict-origin-when-cross-origin
I0610 15:30:14.746857    6768 request_token.go:92] SSPI Enabled
I0610 15:30:14.746857    6768 round_trippers.go:419] curl -k -v -XGET  -H "X-Csrf-Token: 1" 'https://console-openshift-console.apps.us-west-1.online-starter.openshift.com:443/.well-known/oauth-authorization-server'
I0610 15:30:15.085208    6768 round_trippers.go:438] GET https://console-openshift-console.apps.us-west-1.online-starter.openshift.com:443/.well-known/oauth-authorization-server 200 OK in 338 milliseconds
I0610 15:30:15.085208    6768 round_trippers.go:444] Response Headers:
I0610 15:30:15.086206    6768 round_trippers.go:447]     X-Dns-Prefetch-Control: off
I0610 15:30:15.086206    6768 round_trippers.go:447]     Date: Mon, 10 Jun 2019 12:30:14 GMT
I0610 15:30:15.087203    6768 round_trippers.go:447]     Cache-Control: private
I0610 15:30:15.087203    6768 round_trippers.go:447]     Content-Type: text/html; charset=utf-8
I0610 15:30:15.088200    6768 round_trippers.go:447]     Referrer-Policy: strict-origin-when-cross-origin
I0610 15:30:15.088200    6768 round_trippers.go:447]     Set-Cookie: csrf-token=nowDCVVg+iMNf9Ldc6MldQJwsIgg8Tltk5djsue2h3uZy7woy7F1b0SfTQkv1Lw2kO3cs+82mOFOgE0Io5VUGQ==; Path=/; Secure
I0610 15:30:15.088200    6768 round_trippers.go:447]     Set-Cookie: 1e2670d92730b515ce3a1bb65da45062=a7f4fcdbc17050ff7e35cf025b9ceaf2; path=/; HttpOnly; Secure
I0610 15:30:15.089199    6768 round_trippers.go:447]     X-Content-Type-Options: nosniff
I0610 15:30:15.089199    6768 round_trippers.go:447]     X-Frame-Options: DENY
I0610 15:30:15.090228    6768 round_trippers.go:447]     X-Xss-Protection: 1; mode=block
I0610 15:30:15.090228    6768 negotiator_sspi.go:135] Attempt to release SSPI
F0610 15:30:15.090228    6768 helpers.go:116] error: invalid character '<' looking for beginning of value

我做错了什么?

4

2 回答 2

6

您应该使用 登录api URL,而不是控制台 URL,例如https://console-openshift-console.apps.us-west-1.online-starter.openshift.com. api URL6443默认使用端口。

# oc login https://<api url>:6443

更新:

AFAIK,默认api URL配置在kubeconfigauth 文件中。您通常可以登录而无需指定api URL如下。

# export KUBECONFIG=/home/user_id/install/auth/kubeconfig
# oc login

通常,api URL 格式是api.<cluster name>.<domain>.

有关更多详细信息,请参阅OpenShift 4:安装体验

于 2019-06-10T14:06:07.727 回答
1

它对我有用

# oc login https://<api url>:6443
于 2019-12-06T14:02:31.323 回答