Bookmark this page

Deploying Applications by Using the Red Hat OpenShift Web Console

Objectives

  • Deploy simple applications by using the various methods that the Red Hat OpenShift web console provides.

Deploying Applications with the Developer Perspective

Red Hat OpenShift incorporates multiple methods for application deployment, and provides these methods as part of the web console and the CLIs. You can create applications in the cluster by deploying existing container images, and by creating images from git repositories or JAR files, among other options.

As a developer, you can deploy applications and services from the Add screen. To open this screen, select the Developer perspective and, from the left navigation pane, click +Add. The Add screen provides quick access to the different deployment options, as the following screen capture shows:

Most of the elements listed in the Add screen trigger a deployment process, which includes a form view to set the configuration values of the application or the service that you intend to deploy. Although each method provides its own configuration form, many configuration values are shared across the various methods. For example, the application name is included in every form, regardless of the deployment method.

Container Image

This method creates an application in the cluster by deploying an existing container image. You can use any container image that is available in a publicly accessible container registry, such as Quay.io or the Docker Hub.

To deploy an application from a container image, open the Add screen and then click Container Image, which opens the corresponding Deploy Image screen. In the Deploy Image screen, enter the image name. If your container images are private, then you must configure the registry credentials in an Image pull secret. An image pull secret is a Kubernetes Secret object, which Red Hat OpenShift uses to authenticate to private registries.

The Deploy Image form also includes configurable properties for other common aspects of the deployment, such as the application name, the application port, or extra advanced options.

To complete the deployment, click Create at the bottom of the form.

Import from Git

This method creates an application in the cluster by importing the source code from a Git repository, building the container image, and deploying the built image. To deploy an application with this method, open the Add screen and then click Import from Git. In the Import from Git screen, enter the URL of the Git repository.

Optionally, you can set advanced Git options, such as the repository branch, the context directory that contains the application, or a source secret.

Important

If your repository is private, you must define a Source secret. A Source secret is a Kubernetes Secret object that contains Git credentials.

In the following example, the application is at the hello branch, in the hello-java/app-src directory of the DO288-apps repository.

Red Hat OpenShift can automatically build a container image from the source code. After you enter the repository details, the cluster analyzes the repository contents, and automatically tries to select the best import strategy. The import strategy dictates how the cluster builds the application container image. For example, in the following screen capture, OpenShift has detected that the context directory of the Git repository contains a Java 17 application.

Note

If you require finer control, you can manually select the import strategy, by clicking Edit Import Strategy.

Based on the contents of the repository, the cluster selects one of the following import strategies.

Devfile

The cluster uses a Devfile as the recipe to build and deploy the application. A Devfile is a YAML file that defines containerized cloud-native application environments. Devfiles include relevant configuration for the development, build, and deployment stages, such as a runtime container image, application ports, and a build command.

The cluster defaults to this method if the repository contains a devfile.yaml file in the context directory.

Dockerfile

The cluster uses a Containerfile to build the application image.

The cluster defaults to this method if the repository contains a Dockerfile file in the context directory, but not a Devfile.

Builder image

The cluster uses a builder image to build the application image, by using a process called Source-to-Image (S2I). In short, S2I detects the runtime of the source code, and then uses a runtime-specific builder image to build the final application image. S2I supports various popular runtimes, such as Java, Node.js, and Python, among many others.

The cluster tries to use this method if the repository does not contain a Dockerfile or a Devfile.

Note

If the cluster cannot infer an import strategy automatically, then you must select one manually.

Similarly to the deployments from a container image, when importing from Git you can configure further aspects of the deployment.

To complete the deployment, click Create at the bottom of the form.

From the Developer Catalog

The developer catalog offers a set of curated recipes that you can use to deploy applications and services. As well as providing shortcuts to preconfigured forms for deploying from repositories and images, the catalog also includes services and additional software, such as databases. To access the developer catalog, open the Add screen and then click any of the items under the Developer Catalog card.

If you click All services, then the web console opens the catalog with no filters applied. If you want to refine your search, then you can select the other items under the Developer Catalog card, such as Database. Alternatively, you can apply filters in the developer catalog screen, as the following screen capture shows:

The developer catalog organizes its content based on the software categories and import types. The following options are the available import types:

Templates

A parametrizable set of resources that the cluster processes to deploy applications and services.

Builder images

Builder images based on S2I. If you use one of these images, then you must provide the URL of the repository that you want to deploy.

Helm Charts

A collection of files that describe Kubernetes and OpenShift resources. A Helm chart is the packaging format of the Helm software package manager. Helm is arguably the most popular way to share and reuse Kubernetes software.

The catalog contains Helm charts to deploy services and applications.

Operator Backed

Services that are managed by operators, such as databases. Cluster administrators typically install and manage operators, adding capabilities to the cluster. Depending on the operator, sometimes these capabilities display as operator backed services available in the catalog.

Note

Regardless of how each import type handles the deployment processes internally, the web console provides form views to instantiate any catalog item.

From the Local Machine

You can deploy applications by importing JAR files, and YAML and JSON manifests directly into OpenShift.

If you want to import a manifest, then open the Add screen and click Import YAML, which opens a text editor. Use this editor to drag and upload files, or to manually enter YAML or JSON fragments as needed.

If you want to deploy a JAR file from your local computer, then click Upload JAR file from the Add screen.

Common Configuration Properties

Most of the methods that have already been described use visual forms to deploy an application. When comparing the form views of each method, the forms differ in the particularities of each method. For example, some methods require a Git repository as the application source, whereas others require an image name.

These forms, however, typically share the fields and sections that are required to configure the deployed application. For example, when you deploy an application, you can define the application name and the name used for associated resources. You can do this by customizing the Application name and Name fields in the General section.

If you need finer control, then you can customize the parameters under the Advanced options section. This section includes properties, such as the application port, or whether the application is publicly accessible.

You can also define additional parameters to further control your deployment, such as environment variables, resource limits, or health checks. To define these parameters, click the corresponding link at the bottom of the form. The following image displays how the web console displays these elements:

The Topology Screen

After creating a new application with any of the preceding methods, the web console typically redirects you to the Topology screen. This page displays a graph view that shows some of Kubernetes and OpenShift resources created when you deploy an application, such as Deployment objects.

The following capture shows a Go application that a user has just created. Right after the creation of an application, the topology screen displays a light blue circular border of the application icon. This color indicates that the cluster is still in the process of making the application ready, for example, by building the application image.

After the application image is ready, the cluster creates the application pods by using the built image. The border color transitions to dark blue, indicating that the application pods are running, as the following example shows:

Graph View Elements

When you deploy an application by using the developer perspective, Red Hat OpenShift creates an Application abstraction. Internally, an application is the logical grouping of the cluster objects that include the app.kubernetes.io/part-of label.

When you create an application with the developer perspective, OpenShift uses the Application name field to set the app.kubernetes.io/part-of label in the created cluster resources. The topology screen displays the cluster objects that contain this label under the same application. The graph view depicts the application as a rounded-corner rectangle, which is annotated with the A badge.

Note

Some commands in the oc and odo CLIs also create the application abstraction.

Usually, the graph view also displays objects such as Deployment and DeploymentConfig. The graph view displays these objects as circular icons with a badge. The badge is identified with an acronym, which represents the resource type. For example, the acronym for Deployments is D, and the acronym for DeploymentConfigs is DC.

You can organize your applications with the graph view. For example, you can use this view to group multiple deployments into the same application. You can also use the graph view to create visual connections between different elements. This feature is useful to visually represent dependencies between workloads, such as a dependency between a microservice and a database.

Note

The graph view can also create binding connections if the Service Binding operator is installed.

Deploying Applications with the Administrator Perspective

From the Administrator perspective, you have access to the resources available in Kubernetes and OpenShift. The administrator perspective offers a dedicated page for each one these resources, where you can create, view, edit, and delete objects. For example, you can click WorkloadsDeployments to navigate to the deployments page, and then click Create Deployment. On the creation page, you can define the deployment by using either a form view or a YAML view.

Operators and the OperatorHub

If you are an administrator, then installing Operators is a useful way to provide developers with additional software and services. Operators are particularly interesting when a team must add complex software capabilities to their stack, especially if these capabilities require moderate operational effort. For example, an operator such as Red OpenShift Pipelines can enable a team to adopt continuous integration and deployment (CI/CD) techniques, without the need to maintain a dedicated CI/CD server.

Note

This course does not cover the creation of operators.

The OperatorHub is a way to discover Kubernetes applications that are available to install on Red Hat OpenShift. To open the OperatorHub, from the administrator perspective, click OperatorsOperatorHub.

You can use the hub to list and discover operators. To view more details about a particular operator, click the operator card. The pane that opens shows specific instructions and information about the operator. To install the operator, click Install and follow the instructions.

After an administrator installs an operator, developers can use the installed operators to deploy the services that the operator provides. To do this, from the administrator perspective, click OperatorsInstalled Operators. Then, click the operator that you want to use. Finally, from the operator details page, you can create the custom resources that the operator offers. For example, the Crunchy Postgres for Kubernetes operator introduces the Postgres Cluster custom resource. You can create one of these resources to create a PostgreSQL cluster.

Note

Some operators add Operator Backed services to the developer catalog. Therefore, in certain cases, you can use the developer perspective to create applications from installed operators.

References

What is a devfile

For more information about deploying applications in the developer perspective, refer to the Creating applications using the Developer perspective section in the Creating applications chapter in the Red Hat OpenShift Container Platform 4.12 Building applications documentation at https://access.redhat.com/documentation/es-es/openshift_container_platform/4.12/html-single/building_applications/index#odc-creating-applications-using-developer-perspective

For more information about deploying applications in the administrator perspective, refer to the Creating applications from installed Operators section in the Creating applications chapter in the Red Hat OpenShift Container Platform 4.12 Building applications documentation at https://access.redhat.com/documentation/es-es/openshift_container_platform/4.12/html-single/building_applications/index#creating-apps-from-installed-operators

For more information about using image pull secrets to pull from secured registries, refer to the Using image pull secret section in the Managing images chapter in the Red Hat OpenShift Container Platform 4.12 Operators documentation at https://access.redhat.com/documentation/es-es/openshift_container_platform/4.12/html-single/images/index#using-image-pull-secrets

For more information about the topology view, refer to the Viewing application composition using the Topology view chapter in the Red Hat OpenShift Container Platform 4.12 Building applications documentation at https://access.redhat.com/documentation/es-es/openshift_container_platform/4.12/html-single/building_applications/index#odc-viewing-application-composition-using-topology-view

For more information about creating visual connections in the topology view, refer to the Creating a visual connection between components section in the Connecting applications to services chapter in the Red Hat OpenShift Container Platform 4.12 Building applications documentation at https://access.redhat.com/documentation/en-us/openshift_container_platform/4.12/html-single/building_applications/index#odc-creating-a-visual-connection-between-components_odc-connecting-an-application-to-a-service-using-the-developer-perspective

For more information about Operators, refer to the Understanding Operators chapter in the Red Hat OpenShift Container Platform 4.12 Operators documentation at https://access.redhat.com/documentation/en-us/openshift_container_platform/4.12/html-single/operators/index#understanding-operators

Revision: do288-4.12-0d49506