Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What server URL should be used for the `oc login` command when using OpenShift's PaaS?

Tags:

What do I provide for the server URL in the oc login tool, when using the OpenShift PaaS?

I'm trying to migrate my OpenShift Online v2 app to v3, following the instructions for PHP apps linked to from OpenShift's Migration Center. That page says to run something following the pattern oc new-app https://github.com/<github-id>/<repo-name>.git --name=<app-name> -e <ENV_VAR_NAME>=<env_var_value>. After tracking down a download for oc (which wasn't easy), I tried running that command with my repo URL*; this results in:

$ oc new-app https://[email protected]/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.

Not knowing what subcommand of oc config to use, I searched and found Get Started with the CLI, which says to use oc login to start the configuration process. But when I run that, I get:

Server [https://localhost:8443]:

What do I provide for the URL here, when using the OpenShift PaaS (i.e. not a local installation)? I've tried things like https://openshift.com/ and the URL of my web app, but both of them result in

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

* I decided to use Bitbucket instead of GitHub; I'm not sure if this is unsupported, or (if it's supported) whether I should be providing [email protected].

like image 879
echristopherson Avatar asked Sep 26 '17 03:09

echristopherson


People also ask

How do I authenticate to an OpenShift Container Platform server?

You can authenticate from the command line using the CLI command oc login . You can get started with the CLI by running this command without any options: The command’s interactive flow helps you establish a session to an OpenShift Container Platform server with the provided credentials.

How do I display the API Server URL in OpenShift?

The oc config view or oc get apiserver commands can be used to display the API Server URL (api.openshift.example.com in this example), but you need to be logged in to use these commands. Before version 4.7 of OpenShift, the oc login command could be used without the -u or --username option.

What is OC login in OpenShift?

The oc login command is used to authenticate against the API service in the master node. The oc config view or oc get apiserver commands can be used to display the API Server URL (api.openshift.example.com in this example), but you need to be logged in to use these commands.

What are the CLI configuration options in OpenShift?

Table 1. Common CLI Configuration Options Specifies the host name of the OpenShift Container Platform server. If a server is provided through this flag, the command does not ask for it interactively. This flag can also be used if you already have a CLI configuration file and want to log in and switch to another server.


1 Answers

It is right over there in the web console. Click on (?) help icon right beside your user name on top right corner. Select 'Command Line Tool' from the drop down menu.

Alternatively, it is there in the URL :

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

e.g. it is mentioned on the below URL for me:

https://console.starter-ca-central-1.openshift.com/console/command-line

Hope it helps.

like image 137
Gyanendra Dwivedi Avatar answered Sep 28 '22 22:09

Gyanendra Dwivedi