Compare commits
4 Commits
f18e4ce9d5
...
d0c942d01f
| Author | SHA1 | Date | |
|---|---|---|---|
| d0c942d01f | |||
| 04f704d75b | |||
| e7c8793b00 | |||
| dc63240981 |
@ -14,7 +14,7 @@ The OpenShift Container Platform web console is a feature-rich web console with
|
|||||||
|
|
||||||
In addition to the web console, OpenShift includes command line tools to provide users with a nice interface to work with applications deployed to the platform. The `oc` command line tool is available for Linux, macOS or Windows.
|
In addition to the web console, OpenShift includes command line tools to provide users with a nice interface to work with applications deployed to the platform. The `oc` command line tool is available for Linux, macOS or Windows.
|
||||||
|
|
||||||
Let's get started!
|
**Let's get started!**
|
||||||
|
|
||||||
## 1.1 - Login to lab environment
|
## 1.1 - Login to lab environment
|
||||||
|
|
||||||
@ -22,23 +22,23 @@ An OpenShift `4.14` cluster has already been provisioned for you to complete the
|
|||||||
|
|
||||||
Once the page loads you can login with the details provided by your workshop facilitator.
|
Once the page loads you can login with the details provided by your workshop facilitator.
|
||||||
|
|
||||||
<zoom>
|
<Zoom>
|
||||||

|

|
||||||
</zoom>
|
</Zoom>
|
||||||
|
|
||||||
|
|
||||||
## 1.2 - Login to the cluster web console
|
## 1.2 - Login to the cluster web console
|
||||||
|
|
||||||
Once you're logged into the lab environnment we can open up the OpenShift web console and login with the credentials provided.
|
Once you're logged into the lab environnment we can open up the OpenShift web console and login with the credentials provided.
|
||||||
|
|
||||||
When first logging in you will be prompted to take a tour of the "Development" console view, let's do that now.
|
When first logging in you will be prompted to take a tour of the **Developer** console view, let's do that now.
|
||||||
|
|
||||||
<zoom>
|
<Zoom>
|
||||||

|

|
||||||
</zoom>
|
</Zoom>
|
||||||
|
|
||||||
|
|
||||||
## 1.3 - Using a project
|
## 1.3 - Understanding projects
|
||||||
|
|
||||||
Projects are a logical boundary to help you organize your applications. An OpenShift project allows a community of users (or a single user) to organize and manage their work in isolation from other projects.
|
Projects are a logical boundary to help you organize your applications. An OpenShift project allows a community of users (or a single user) to organize and manage their work in isolation from other projects.
|
||||||
|
|
||||||
@ -50,7 +50,127 @@ In this lab environment, you already have access to single project: `userX` (Whe
|
|||||||
|
|
||||||
Let's click into our `Project` from the left hand panel of the "Developer" web console view. We should be able to see that our project has no `Deployments` and there are no compute cpu or memory resources currently being consumed.
|
Let's click into our `Project` from the left hand panel of the "Developer" web console view. We should be able to see that our project has no `Deployments` and there are no compute cpu or memory resources currently being consumed.
|
||||||
|
|
||||||
<zoom>
|
<Zoom>
|
||||||

|

|
||||||
</zoom>
|
</Zoom>
|
||||||
|
|
||||||
|
|
||||||
|
## 1.4 - Switching between perspectives
|
||||||
|
|
||||||
|
Different roles have different needs when it comes to viewing details within the OpenShift web console. At the top of the left navigation menu, you can toggle between the Administrator perspective and the Developer perspective.
|
||||||
|
|
||||||
|
Select **Administrator** to switch to the Administrator perspective.
|
||||||
|
|
||||||
|
Once the Administrator perspective loads, you should be in the "Home" view and see a wider array of menu sections in the left hand navigation panel.
|
||||||
|
|
||||||
|
Switch back to the **Developer** perspective. Once the Developer perspective loads, select the **Topology** view.
|
||||||
|
|
||||||
|
Right now, there are no applications or components to view in your `userX` project, but once you begin working on the lab, you’ll be able to visualize and interact with the components in your application here.
|
||||||
|
|
||||||
|
<Zoom>
|
||||||
|

|
||||||
|
</Zoom>
|
||||||
|
|
||||||
|
|
||||||
|
## 1.5 - Launching a web terminal
|
||||||
|
|
||||||
|
While web interfaces are comfortable and easy to use, sometimes we want to quickly run commands to get things done. That is where the `oc` command line utility comes in.
|
||||||
|
|
||||||
|
One handy feature of the OpenShift web console is we can launch a web terminal that will create a browser based terminal that already has the `oc` command logged in and ready to use.
|
||||||
|
|
||||||
|
Let's launch a web terminal now by clicking the terminal button in the top right hand corner and then clicking **Start** with our `userX` project selected.
|
||||||
|
|
||||||
|
<Zoom>
|
||||||
|

|
||||||
|
</Zoom>
|
||||||
|
|
||||||
|
|
||||||
|
## 1.6 - Running oc commands
|
||||||
|
|
||||||
|
The [`oc` command line utility](https://docs.openshift.com/container-platform/4.14/cli_reference/openshift_cli/getting-started-cli.html#creating-a-new-app) is a superset of the upstream kubernetes `kubectl` command line utility. This means it can do everything that `kubectl` can do, plus some additional OpenShift specific commands.
|
||||||
|
|
||||||
|
Let's try a few commands now:
|
||||||
|
|
||||||
|
|
||||||
|
### Checking our current project
|
||||||
|
|
||||||
|
Most actions we take in OpenShift will be in relation to a particular project. We can check which project we are currently actively using by running the `oc project` command.
|
||||||
|
|
||||||
|
We should see output similar to below showing we are currently using our `userX` project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash-4.4 ~ $ oc project
|
||||||
|
Using project "user1" from context named "user1-context" on server "https://172.31.0.1:443".
|
||||||
|
```
|
||||||
|
|
||||||
|
### Getting help and explaining concepts
|
||||||
|
|
||||||
|
As with any command line utility, there can be complexity that quickly surfaces. Thankfully the `oc` command line utility has excellent built in help.
|
||||||
|
|
||||||
|
Let's take a look at that now.
|
||||||
|
|
||||||
|
To get an understanding of all the options available, try running `oc help`. You should see options similar to the below sample:
|
||||||
|
|
||||||
|
```text
|
||||||
|
bash-4.4 ~ $ oc help
|
||||||
|
OpenShift Client
|
||||||
|
|
||||||
|
This client helps you develop, build, deploy, and run your applications on any
|
||||||
|
OpenShift or Kubernetes cluster. It also includes the administrative
|
||||||
|
commands for managing a cluster under the 'adm' subcommand.
|
||||||
|
|
||||||
|
Basic Commands:
|
||||||
|
login Log in to a server
|
||||||
|
new-project Request a new project
|
||||||
|
new-app Create a new application
|
||||||
|
status Show an overview of the current project
|
||||||
|
project Switch to another project
|
||||||
|
projects Display existing projects
|
||||||
|
explain Get documentation for a resource
|
||||||
|
|
||||||
|
Build and Deploy Commands:
|
||||||
|
rollout Manage a Kubernetes deployment or OpenShift deployment config
|
||||||
|
rollback Revert part of an application back to a previous deployment
|
||||||
|
new-build Create a new build configuration
|
||||||
|
start-build Start a new build
|
||||||
|
cancel-build Cancel running, pending, or new builds
|
||||||
|
import-image Import images from a container image registry
|
||||||
|
tag Tag existing images into image streams
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
To get a more detailed explanataion about a specific concept we can use the `oc explain` command.
|
||||||
|
|
||||||
|
Let's run `oc explain project` now to learn more about the concept of a project we introduced earlier:
|
||||||
|
|
||||||
|
```text
|
||||||
|
bash-4.4 ~ $ oc explain project
|
||||||
|
KIND: Project
|
||||||
|
VERSION: project.openshift.io/v1
|
||||||
|
|
||||||
|
DESCRIPTION:
|
||||||
|
Projects are the unit of isolation and collaboration in OpenShift. A
|
||||||
|
project has one or more members, a quota on the resources that the project
|
||||||
|
may consume, and the security controls on the resources in the project.
|
||||||
|
Within a project, members may have different roles - project administrators
|
||||||
|
can set membership, editors can create and manage the resources, and
|
||||||
|
viewers can see but not access running containers. In a normal cluster
|
||||||
|
project administrators are not able to alter their quotas - that is
|
||||||
|
restricted to cluster administrators.
|
||||||
|
|
||||||
|
Listing or watching projects will return only projects the user has the
|
||||||
|
reader role on.
|
||||||
|
|
||||||
|
An OpenShift project is an alternative representation of a Kubernetes
|
||||||
|
namespace. Projects are exposed as editable to end users while namespaces
|
||||||
|
are not. Direct creation of a project is typically restricted to
|
||||||
|
administrators, while end users should use the requestproject resource.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
That's a quick introduction to the `oc` command line utility. Let's close our web terminal now so we can move on to the next excercise.
|
||||||
|
|
||||||
|
<Zoom>
|
||||||
|

|
||||||
|
</Zoom>
|
||||||
|
|||||||
39
data/workshop/exercise2.mdx
Normal file
39
data/workshop/exercise2.mdx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
title: Deploying our first application
|
||||||
|
exercise: 2
|
||||||
|
date: '2023-12-05'
|
||||||
|
tags: ['openshift','containers','kubernetes','deployments','images']
|
||||||
|
draft: false
|
||||||
|
authors: ['default']
|
||||||
|
summary: "Time to deploy our first app!"
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Now that we have had a tour of the OpenShift web console to get familar, let's use the web console to deploy our first application.
|
||||||
|
|
||||||
|
Let’s start by doing the simplest thing possible - get a plain old Docker-formatted container image to run on OpenShift. This is incredibly simple to do. With OpenShift it can be done directly from the web console.
|
||||||
|
|
||||||
|
Before we begin, if you would like a bit more background on what a container is or why they are important click the following link to learn more: https://www.redhat.com/en/topics/containers#overview
|
||||||
|
|
||||||
|
|
||||||
|
## 2.1 - Deploying the container image
|
||||||
|
|
||||||
|
Within the **Developer** perspective, click the **+Add** entry on the left hand menu.
|
||||||
|
|
||||||
|
Once on the **+Add** page, click **Container images** to open a dialog that will allow you to quickly deploy an image.
|
||||||
|
|
||||||
|
In the **Image name** field enter the following:
|
||||||
|
|
||||||
|
```text
|
||||||
|
quay.io/openshiftroadshow/parksmap:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Leave all other fields at their defaults (but take your time to scroll down and review each one to familarise yourself! 🎓)
|
||||||
|
|
||||||
|
Click **Create** to deploy the application.
|
||||||
|
|
||||||
|
OpenShift will pull this container image if it does not exist already on the cluster and then deploy a container based on this image. You will be taken back to the **Topology** view in the **Developer** perspective which will show the new "Parksmap" application.
|
||||||
|
|
||||||
|
<Zoom>
|
||||||
|

|
||||||
|
</Zoom>
|
||||||
BIN
public/static/images/close-terminal.gif
Normal file
BIN
public/static/images/close-terminal.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
BIN
public/static/images/first-app.gif
Normal file
BIN
public/static/images/first-app.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 MiB |
BIN
public/static/images/perspectives.gif
Normal file
BIN
public/static/images/perspectives.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 MiB |
BIN
public/static/images/web-terminal.gif
Normal file
BIN
public/static/images/web-terminal.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 MiB |
Reference in New Issue
Block a user