Easy application deployment with OpenShift Container Platform

OpenShift Container Platform (OCP) is an enterprise-ready Kubernetes distribution from Red Hat. OCP enables companies to run production-grade applications with ease. OCP can run on top of any infrastructure, from bare metal servers to public cloud providers.

OCP provides many options for the developer to deploy their applications on top of OCP. All available deployment options in OCP are in this picture below:

Application Topology View
Application Topology View

This post will talk about one deployment method in OCP, which eases the process of application modernization. This feature is From Git deployment option. We can import/deploy our legacy application to run on top OCP without any required knowledge about containers or Kubernetes before. We can lift and shift our application into a modern platform quickly.

Using From Git feature is very simple. All we need to supply is our Git repo URL to OCP and also configure our application name. OCP supports public and private Git repositories. You need to provide an access token for a private Git repository using the Secret feature from OCP.

OCP will read your Git repository content, then recommend the most suitable Builder Image for your application. There are builder images for Perl, PHP, Nginx, Httpd, Golang, Ruby, Python, Java, Node.js, and dotnet Core. We can see the form in the picture below:

From Git deployment details
From Git deployment details

For this particular example, I will try to deploy a simple Python application built on top Flask framework into OCP. You can access the Python application from this Github repository. This application provides API returning books object.

You can see that OCP will access our supplied repository and inform us when no errors occurred on accessing Git repo in the picture below. By default, it will try to access the main or master branch first, but we can specify a branch, tag, or event commit Id.

OCP validates Git repository
OCP validates Git repository

The next step is OCP will recommend a Builder Image for this application, based on the repo content. In this case, OCP recommends using Python builder image, with several versions available as options. We can choose a Python version suitable for running our application; we will use Python 3.8 for this example.

Python Builder Image
Python Builder Image

You will need to input Application Name to group several applications in your topology. Also, you need to supply Name for this deployed application. We will keep the default option for Resources. OCP also will create a route so we can access our application from the Internet.

Options for Deployment
Options for Deployment

We can configure other advanced options, but let’s deploy it now. We can monitor the progress for deployment in the Topology view.

Application in Topology View
Application in Topology View

We can see more information about the progress by clicking the app. We will see all details related to the deployment, starting from Pods, Builds pipeline, Services, and Routes configuration. All of this information is presented in easy to learn and navigate user interface. This single web console is the most significant added value in OCP.

Detailed information for application
Detailed information for application

After waiting for several minutes, we will see that our application is running. We can test it by accessing it via the URL provided in the Routes section. And voila, our application is now available and deployed on top Kubernetes platform, without creating any configuration for Kubernetes resources.

We can scale our application quickly too. In this example, we will scale our app to run three pods. All requests to these pods are managed automatically and balanced between these pods.

Scaling Up Application
Scaling Up Application
All 3 pods are running
All 3 pods are running

We can explore many other OCP features, but it can be hard to set up your OCP cluster. OCP requires quite significant resources to run, and it can lead to expensive billing. In this post, we also want to introduce Developer Sandbox for Red Hat OpenShift, the newest attempt from Red Hat to ease your container journey to OpenShift Container Platform.

Developer Sandbox for Red Hat OpenShift provides a dedicated OCP cluster for you developers to learn about OCP and other Red Hat technology. You can also develop your application directly using CodeReady Workspaces, a cloud-native IDE. All you need to do to have these is register to the Red Hat Developer site. You can also find other tutorials, i.e., creating microservices in Java or creating apps using Node.js. All of these tutorials will run on top of OCP as well.

That’s all about deployment using From Git in OCP. It is an excellent method for migrating legacy applications into modern platform.