使用OpenShift的PaaS时,`oc login`命令应该使用什么服务器URL?

时间:2017-09-26 03:08:44

标签: openshift

使用OpenShift PaaS时,我在oc login工具中为服务器网址提供了哪些内容?

我正在尝试按照the instructions for PHP apps linked to from OpenShift's Migration Center将我的OpenShift Online v2应用迁移到v3。该页面表示按照模式oc new-app https://github.com/<github-id>/<repo-name>.git --name=<app-name> -e <ENV_VAR_NAME>=<env_var_value>运行某些内容。在追踪到oc的下载(这不容易)后,我尝试用我的repo URL *运行该命令;结果如下:

$ oc new-app https://USERNAME@bitbucket.org/USERNAME/PROJECTNAME.git --name=PROJECTNAME
error: Missing or incomplete configuration info.  Please login or point to an existing, complete config file:

  1. Via the command-line flag --config
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.

我不知道要使用oc config的哪个子命令,我搜索并找到了Get Started with the CLI,它说使用oc login来启动配置过程。但当我运行时,我得到:

Server [https://localhost:8443]:

使用OpenShift PaaS(即非本地安装)时,我在此处为URL提供了什么?我尝试了https://openshift.com/之类的内容和我的网络应用的网址,但两者都会产生

error: The server was unable to respond - verify you have provided the correct host and port and that the server is currently running.

*我决定使用Bitbucket代替GitHub;我不确定这是否不受支持,或者(如果支持的话)我是否应该提供USERNAME@bitbucket.org

6 个答案:

答案 0 :(得分:12)

Web控制台就在那边。 点击右上角用户名右侧的from itertools import izip_longest for posttitle, poster, postdateandtime, postcontent in izip_longest(posttitle, poster, postdateandtime, postcontent, fillvalue=posttitle[-1): writer.writerow([posttitle, poster, postdateandtime, postcontent]) 帮助图标。从下拉菜单中选择(?)

或者,它位于URL中:

'Command Line Tool'

e.g。我在下面的URL中提到了:

http://<openshift url>/console/command-line

希望它有所帮助。

答案 1 :(得分:2)

在Web控制台上,单击您的个人资料,然后您会看到“复制登录命令”,如下所示: enter image description here

然后,您只需单击它,然后在新的浏览器选项卡中的“显示令牌”按钮上再次进行操作。这是您的令牌的样子: enter image description here

答案 2 :(得分:1)

我刚刚尝试注册OpenShift v3 Starter计划(之前我没有做过,因为我不想超越自己,而且迁移指南没有说过这样做)。这一过程确实让我可以访问the "Command Line Tools" menu item under the ? menu,命令行为oc login https://api.starter-us-east-1.openshift.com --token=<hidden>。 (如果单击该行右侧的剪贴板图标,则隐藏的令牌将复制到剪贴板。)

答案 3 :(得分:1)

我为OpenShift v3 Starter计划创建了一个帐户。 然后我安装了OC Tool here。 我在美国西部创建了一个名为spike1的项目。 最后,当运行 oc login 并将服务器URL设置为https://console.starter-us-west-1.openshift.com/

希望这有帮助。

答案 4 :(得分:1)

在公共OpenShift中创建项目后。它重定向到我的控制台 starter-us-west-1.openshift.com/console/ 如果要使用CLI登录到openshift。 命令是 oc login https://console.starter-us-west-1.openshift.com

答案 5 :(得分:1)

在RedHat OpenShift Online Web控制台中,单击右上角用户名旁边的(?)帮助图标。从下拉菜单中选择'Command Line Tools'

出现一个弹出窗口,其中显示“ oc-OpenShift命令行界面(CLI)”部分,其中有一个Copy Login Command的链接。点击该链接,您将转到类似

的页面
  

https://oauth-openshift.apps.ca-central-1.starter.openshift-online.com/oauth/token/display?code=Ge .....

(此时可能会提示您登录Redhat Portal,如有必要,请执行该操作。)

然后页面将显示文本

  

显示令牌

点击Display Token

它将显示类似于以下内容的输出:

  

使用此令牌登录

     

oc login --token = ... --server = https://api.ca-central-1.starter.openshift-online.com:6443