In this lab you will get familiar with OpenShift Web Console and OpenShift CLI and gain some experience interactive with an OpenShift cluster.
You can use the terminal on your workstation for running the OpenShift CLI commands, provided you {{OPENSHIFT_DOCS_BASE}}/cli_reference/get_started_cli.html[download the OpenShift CLI] and add it to your path.
You might be familiar with the Eclipse IDE which is one of the most popular IDEs for Java and other programming languages. Eclipse Che is the next-generation Eclipse IDE which is web-based and gives you a full-featured IDE running in the cloud. You have an Eclipse Che instance deployed on the OpenShift cluster which you can use during these labs for creating files and running OpenShift CLI commands.
Eclipse Che: {{ECLIPSE_CHE_URL}}
Register on Eclipse Che with any email and the same username as your OpenShift username, and the log in.
In the Eclipse Che dashboard, select the Java with OpenShift CLI stack and then click on Create button, and Open button to create and open a workspace for yourself.
It might take a little while till your IDE workspace is setup in the browser. You can now use the Terminal window in Eclipse Che to run any OpenShift CLI command.
In order to login, you can use the oc
command and then specify the server that you want to authenticate to. Issue the following command:
$ oc login {{OPENSHIFT_URL}}
Enter Y to use a potentially insecure connection. The reason you received this message is because we are using a self-signed certificate for this workshop, but we did not provide you with the CA certificate that was generated by OpenShift. In a real-world scenario, either OpenShift certificate would be signed by a standard CA (eg: Thawte, Verisign, StartSSL, etc.) or signed by a corporate-standard CA that you already have installed on your system.
Once you issue the oc login
command, you will be prompted for the username and password combination for your user account. Replace XX with the username given to you by the instructor:
Caution
|
Replace {{PROJECT_SUFFIX}} with the number provided to you by the instructor.
|
-
Username:
{{OPENSHIFT_USER}}
-
Password:
{{OPENSHIFT_PASSWORD}}
Projects are a top level concept to help you organize your deployments. An OpenShift project allows a community of users (or a user) to organize and manage their content in isolation from other communities. Each project has its own resources, policies (who can or cannot perform actions), and constraints (quotas and limits on resources, etc). Projects act as a "wrapper" around all the application services and endpoints you (or your teams) are using for your work. You can see the list of projects you have access to using the following command:
$ oc get projects
Now you can create a project:
Caution
|
Replace {{PROJECT_SUFFIX}} with the number provided to you by the instructor.
|
$ oc new-project explore-{{PROJECT_SUFFIX}}
When using OpenShift CLI, you can specify in which project the command should be executed using the -n
switch. If not specified, OpenShift will run the command in the active project. You can switch between active projects using the oc project
command:
Caution
|
Replace {{PROJECT_SUFFIX}} with the number provided to you by the instructor.
|
$ oc project explore-{{PROJECT_SUFFIX}}
Now using project "explore-{{PROJECT_SUFFIX}}" on server "{{OPENSHIFT_URL}}".
OpenShift ships with a web-based console that will allow users to perform various tasks via a browser. To get a feel for how the web console works, open your browser and go to the following URL: {{OPENSHIFT_URL}}
Since the security certificates used for securing your OpenShift cluster are self-generated and self-signed, your browser will not trust them by default and will show a security warning similar to the following:
In Chrome browser, click on ADVANCED and then Proceed to … (unsafe) to trust the certificates. In Firefox browser, click on Advanced button, then Add Exception… and then confirm trusting the certificate by click on Confirm Security Exception.
The first screen you will see is the authentication screen. Enter in the following credentials:
Caution
|
Replace {{PROJECT_SUFFIX}} with the number provided to you by the instructor.
|
-
Username:
{{OPENSHIFT_USER}}
-
Password:
{{OPENSHIFT_PASSWORD}}
After you have authenticated to the web console, you will be presented with a list of projects that your user has permission to work with.
When you click on the explore-{{PROJECT_SUFFIX}} project, you will be taken to the project overview page which will list all of the routes, services, deployments, and pods that you have running as part of your project. There’s nothing there now, but in the following labs you will create deployments and other resources in your projects.
You can delete a project (and other resources) using the oc delete
command. You won’t need the explore-{{PROJECT_SUFFIX}} project in the following labs and therefore you can clean up your environment by removing it:
Caution
|
Replace {{PROJECT_SUFFIX}} with the number provided to you by the instructor.
|
$ oc delete project explore-{{PROJECT_SUFFIX}}