The first thing we want to do to ensure that our oc
command line tools was
installed and successfully added to our path is login to the OpenShift
environment that has been provided for this Roadshow session. In
order to login, we will use the oc
command and then specify the server that we
want to authenticate to. Issue the following command:
$ oc login {{CONSOLE_ADDRESS}}
You may see the following output:
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n):
Enter in 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’s 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.
Note
|
On some versions of Microsoft Windows, you may get an error that the server has an invalid x.509 certificate. If you receive this error, enter in the following command:
|
Once you issue the oc login
command, you will be prompted for the username and
password combination for your user account:
Username: {{USER_NAME}}
Password: {{USER_PASSWORD}}
Once you have authenticated to the OpenShift server, you will see the following confirmation message:
Login successful.
{% if NO_USER_PROJECT != true %}
Using project "{{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}}".
{% endif %}
Congratulations, you are now authenticated to the OpenShift server. The OpenShift master includes a built-in OAuth server. Developers and administrators obtain OAuth access tokens to authenticate themselves to the API. By default your authorization token will last for 24 hours. There is more information about the login command and its configuration in the OpenShift Documentation.
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. For this first lab, we are going to use a project named smoke that has been created and populated with an application for you.
During this lab, we are going to use a few different commands to make sure that things in the environment are working as expected. Don’t worry if you don’t understand all of the terminology as we will cover it in detail in later labs.
{% if NO_USER_PROJECT == true %} The first thing we want to do is create the {{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}} project. You can do this with the following command:
$ oc new-project {{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}}
You will see the following confirmation message:
Now using project "{{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}}" on server "https://{{CONSOLE_ADDRESS}}".
{% else %} The first thing we want to do is switch to the {{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}} project. You can do this with the following command:
$ oc project {{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}}
You will see the following confirmation message:
Now using project "{{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}}" on server "https://{{CONSOLE_ADDRESS}}".
{% endif %}
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:
The first screen you will see is the authentication screen. Enter in the following credentials:
Username: {{USER_NAME}}
Password: {{USER_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. You will see something that looks like the following image:
Click on the {{EXPLORE_PROJECT_NAME}}{{USER_SUFFIX}} project. When you click on the {{EXPLORE_PROJECT_NAME}}{{USER_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 that’s about to change.
{% if METRICS_ENABLED %}
Lastly, the web console will show you an error: An error occurred getting metrics. We need to accept another self-signed certificate for OpenShift’s metrics aggregation. If we don’t, then the metrics will not display in the OpenShift UI.
Click the link that says Open metrics URL, and accept the certificate.
{% endif %}
We will be using a mix of command line tooling and the web console for the labs. Get ready!