From 372524a6debba388f0038cdf6c3db59d7f1a8155 Mon Sep 17 00:00:00 2001 From: James Blair Date: Mon, 18 Dec 2023 20:18:19 +1300 Subject: [PATCH] Start working on openshift disconnected lab. --- README.org | 5 +- data/app-delivery/exercise1.mdx | 191 ++++++++++++++++++ data/{workshop => app-delivery}/exercise2.mdx | 0 data/{workshop => app-delivery}/exercise3.mdx | 0 data/{workshop => app-delivery}/exercise4.mdx | 0 data/{workshop => app-delivery}/exercise5.mdx | 0 data/{workshop => app-delivery}/exercise6.mdx | 0 data/authors/default.md | 12 +- data/authors/sparrowhawk.md | 12 -- data/workshop/exercise1.mdx | 166 +-------------- 10 files changed, 202 insertions(+), 184 deletions(-) create mode 100644 data/app-delivery/exercise1.mdx rename data/{workshop => app-delivery}/exercise2.mdx (100%) rename data/{workshop => app-delivery}/exercise3.mdx (100%) rename data/{workshop => app-delivery}/exercise4.mdx (100%) rename data/{workshop => app-delivery}/exercise5.mdx (100%) rename data/{workshop => app-delivery}/exercise6.mdx (100%) delete mode 100644 data/authors/sparrowhawk.md diff --git a/README.org b/README.org index 7d9f59d..ec65b97 100644 --- a/README.org +++ b/README.org @@ -1,11 +1,10 @@ -#+TITLE: OpenShift Application Delivery Workshop +#+TITLE: OpenShift Workshops #+AUTHOR: James Blair #+DATE: <2023-12-04 Mon> This repository contains a basic [[https://nextjs.org/][nextjs]] frontend designed to be exported as a static site and served via [[https://pages.github.com/][github pages]]. -The frontend contains a walkthrough for workshop designed to be run over three hours covering basic application delivery, monitoring and security on OpenShift. The workshop content is tailored towards participants that are new to containers and kubernetes and will not be developing applications but will instead be expected to deliver existing applications onto OpenShift. - +The frontend is used to serve workshop instructions for several workshops. ** Local development diff --git a/data/app-delivery/exercise1.mdx b/data/app-delivery/exercise1.mdx new file mode 100644 index 0000000..eaeee1b --- /dev/null +++ b/data/app-delivery/exercise1.mdx @@ -0,0 +1,191 @@ +--- +title: Getting familiar with OpenShift +exercise: 1 +date: '2023-12-04' +tags: ['openshift','containers','kubernetes'] +draft: false +authors: ['default'] +summary: "In this first exercise we'll get familiar with OpenShift." +--- + +Red Hat [OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) is a unified platform to build, modernize, and deploy applications at scale. In this first excercise we'll get logged into our cluster and familarise ourselves with the OpenShift web console and web terminal. + +The OpenShift Container Platform web console is a feature-rich user interface with both an **Administrator** perspective and a **Developer** perspective accessible through any modern web browser. You can use the web console to visualize, browse, and manage your OpenShift cluster and the applications running on it. + +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!** + +## 1.1 - Login to lab environment + +An OpenShift `4.14` cluster has already been provisioned for you to complete these excercises. Open your web browser and navigate to the workshop login page https://demo.redhat.com/workshop/enwmgc. + +Once the page loads you can login with the details provided by your workshop facilitator. + + +|![workshop](/workshops/static/images/workshop.png) | +|:-----------------------------------------------------------------------------:| +| *Workshop login page* | + + + +## 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. + +When first logging in you will be prompted to take a tour of the **Developer** console view, let's do that now. + + +| ![tour](/workshops/static/images/tour.gif) | +|:-----------------------------------------------------------------------------:| +| *Developer perspective web console tour* | + + + +## 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. + +Each project has its own resources, role based access control (who can or cannot perform actions), and constraints (quotas and limits on resources, etc). + +Projects act as a "wrapper" around all the application services you (or your teams) are using for your work. + +In this lab environment, you already have access to single project: `userX` (Where X is the number of your user allocted for the workshop from the previous step.) + +Let's click into our `Project` from the left hand panel of the **Developer** web console perspective. We should be able to see that our project has no `Deployments` and there are no compute cpu or memory resources currently being consumed. + + +|![project](/workshops/static/images/project.png) | +|:-----------------------------------------------------------------------------:| +| *Developer perspective project view* | + + + +## 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. + + +|![perspectives](/workshops/static/images/perspectives.gif) | +|:-----------------------------------------------------------------------------:| +| *Switching web console perspectives* | + + + + +## 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. + + +|![web-terminal](/workshops/static/images/web-terminal.gif) | +|:-----------------------------------------------------------------------------:| +| *Launching your web terminal* | + + + +## 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. + + +|![close-terminal](/workshops/static/images/close-terminal.gif) | +|:-----------------------------------------------------------------------------:| +| *Closing your web terminal* | + + +Well done, you've finished exercise 1! 🎉 diff --git a/data/workshop/exercise2.mdx b/data/app-delivery/exercise2.mdx similarity index 100% rename from data/workshop/exercise2.mdx rename to data/app-delivery/exercise2.mdx diff --git a/data/workshop/exercise3.mdx b/data/app-delivery/exercise3.mdx similarity index 100% rename from data/workshop/exercise3.mdx rename to data/app-delivery/exercise3.mdx diff --git a/data/workshop/exercise4.mdx b/data/app-delivery/exercise4.mdx similarity index 100% rename from data/workshop/exercise4.mdx rename to data/app-delivery/exercise4.mdx diff --git a/data/workshop/exercise5.mdx b/data/app-delivery/exercise5.mdx similarity index 100% rename from data/workshop/exercise5.mdx rename to data/app-delivery/exercise5.mdx diff --git a/data/workshop/exercise6.mdx b/data/app-delivery/exercise6.mdx similarity index 100% rename from data/workshop/exercise6.mdx rename to data/app-delivery/exercise6.mdx diff --git a/data/authors/default.md b/data/authors/default.md index 8fcffd1..3f1f3c4 100644 --- a/data/authors/default.md +++ b/data/authors/default.md @@ -1,8 +1,8 @@ -name: Red Hat +name: James Blair avatar: /static/images/redhat.png -occupation: TSSC Workshop -company: Open Source -email: redhat@redhat.com +occupation: Specialist Architect +company: Red Hat +email: jablair@redhat.com twitter: https://twitter.com/RedHat -github: https://github.com/RedHat -linkedin: https://www.linkedin.com/in/RedHat \ No newline at end of file +github: https://github.com/jmhbnz +linkedin: https://www.linkedin.com/in/RedHat diff --git a/data/authors/sparrowhawk.md b/data/authors/sparrowhawk.md deleted file mode 100644 index 4294082..0000000 --- a/data/authors/sparrowhawk.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: Sparrow Hawk -avatar: /static/images/sparrowhawk-avatar.jpg -occupation: Wizard of Earthsea -company: Earthsea -twitter: https://twitter.com/sparrowhawk -linkedin: https://www.linkedin.com/sparrowhawk ---- - -At birth Ged was given the child-name Duny by his mother. He was born on the island of Gont, son of a bronzesmith. His mother died before he reached the age of one. As a small boy, Ged had overheard the village witch, his maternal aunt, using various words of power to call goats. Ged later used the words without understanding of their meanings, to surprising effect. - -The witch knew that using words of power effectively without understanding them required innate power, so she endeavored to teach him what little she knew. After learning more from her, he was able to call animals to him. Particularly, he was seen in the company of wild sparrowhawks so often that his "use name" became Sparrowhawk. diff --git a/data/workshop/exercise1.mdx b/data/workshop/exercise1.mdx index eaeee1b..984a7a0 100644 --- a/data/workshop/exercise1.mdx +++ b/data/workshop/exercise1.mdx @@ -1,11 +1,11 @@ --- -title: Getting familiar with OpenShift +title: Understanding the lab environment exercise: 1 -date: '2023-12-04' +date: '2023-12-18' tags: ['openshift','containers','kubernetes'] draft: false authors: ['default'] -summary: "In this first exercise we'll get familiar with OpenShift." +summary: "Let's get familiar with the lab setup." --- Red Hat [OpenShift](https://www.redhat.com/en/technologies/cloud-computing/openshift) is a unified platform to build, modernize, and deploy applications at scale. In this first excercise we'll get logged into our cluster and familarise ourselves with the OpenShift web console and web terminal. @@ -29,163 +29,3 @@ Once the page loads you can login with the details provided by your workshop fac -## 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. - -When first logging in you will be prompted to take a tour of the **Developer** console view, let's do that now. - - -| ![tour](/workshops/static/images/tour.gif) | -|:-----------------------------------------------------------------------------:| -| *Developer perspective web console tour* | - - - -## 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. - -Each project has its own resources, role based access control (who can or cannot perform actions), and constraints (quotas and limits on resources, etc). - -Projects act as a "wrapper" around all the application services you (or your teams) are using for your work. - -In this lab environment, you already have access to single project: `userX` (Where X is the number of your user allocted for the workshop from the previous step.) - -Let's click into our `Project` from the left hand panel of the **Developer** web console perspective. We should be able to see that our project has no `Deployments` and there are no compute cpu or memory resources currently being consumed. - - -|![project](/workshops/static/images/project.png) | -|:-----------------------------------------------------------------------------:| -| *Developer perspective project view* | - - - -## 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. - - -|![perspectives](/workshops/static/images/perspectives.gif) | -|:-----------------------------------------------------------------------------:| -| *Switching web console perspectives* | - - - - -## 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. - - -|![web-terminal](/workshops/static/images/web-terminal.gif) | -|:-----------------------------------------------------------------------------:| -| *Launching your web terminal* | - - - -## 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. - - -|![close-terminal](/workshops/static/images/close-terminal.gif) | -|:-----------------------------------------------------------------------------:| -| *Closing your web terminal* | - - -Well done, you've finished exercise 1! 🎉