Introduction to OpenShift

What is OpenShift

OpenShift is a packaged offering from Red Hat for container based software deployment. It combines a supported distribution of Kubernetes and DevOps tooling to aid in rapid application development and the full CI/CD process. The solution can run in any environment you desire – Public Cloud, Dedicated Cloud, Private Cloud and On-Prem deployments. For development, it can even run on a developer’s laptop by utilising minishift.

Red Hat has taken standard Kubernetes and configured it with enhanced security; for example, processes no longer run as root by default inside the containers. Therefore you may need to update the images you use to make allowances for the loss of root privilege; for example, your web application does not have access to ports 80/443. Red Hat provides a large number of quick start application templates directly available through the OpenShift web console. These include runtime for common languages, database engines both SQL and NoSQL, and naturally Red Hat middleware offerings.

OpenShift continues to build on the existing Kubernetes automation, adding an additional layer of tooling to streamline CI/CD application life cycle. This additional tooling provides capabilities such as Git integration giving push to container (source to image) and direct deployment from Docker Registries.

Direct Deployment from Docker Hub

OpenShift provides its own Docker Registry, from which containers can be directly deployed. Below is an example workflow of performing such a deployment and update.

First, an image is imported into the OpenShift Registry either by pushing a local image or by pulling from another Registry, such as Docker Hub.

$ oc import-image mongo:3.4.9 --from mongo:3.4.9 --confirm

Here, I have pulled the MongoDB image from Docker Hub and stored it the OpenShift Registry with the same name and tag. I need to provide the confirm flag as this is the creation of the mongo image stream. I can apply additional tags to that image, just like Docker.

$ oc tag mongo:3.4.9 mongo:prod

Now I can directly create a deployment from that image.

$ oc new-app -i mongo:prod --name message-db

This results in a new deployment in the current project called message-db which is linked to the image mongo:prod. The deployment and service definition has been automatically created, you can see the result.

$oc describe dc message-db
$oc describe svc message-db

You can also see the results in the OpenShift dashboard. The URL for this is given when starting minishift; or running the following command will print it out. Login with the user developer and no password.

$ minishift console --url

The Deployment created directly from the image

That has already saved a lot of typing by not having to create YAML files for the deployment and service definitions. Upgrading an image is also just as easy.

$ oc import-image mongo:3.6.1 --from mongo:3.6.1

The confirm flag is not required as we already have the mongo image stream created in the first step. If I update the prod tag on mongo to point to the newer version, OpenShift automatically performs a rolling update because the application was created off the mongo:prod image.

$ oc tag mongo:3.6.1 mongo:prod

The screenshot shows all the tags for the mongo image stream.

Conclusion

I have only scratched the surface of the automation available in OpenShift; in addition to the previously mentioned integration with Git, integration with Jenkins is available. The extra layer of automation that OpenShift provides on top of that already provided by Kubernetes results in improved efficiency and ease of use for the DevOps team.

With this level of automation and abstraction, it becomes even more important to have effective monitoring that can provide visibility into both the platform running your application and the application itself. The huge volume of data produced by observing modern microservice architectures is greater than a human mind can handle. The monitoring system must be able to ingest the continuous flow of time series metric data, request traces and event streams, process it all and produce actionable insights in as near real time as possible.

What About Monitoring?

While we’ve discussed the basic information you need to get OpenShift installed and running, we haven’t talked about performance monitoring of either OpenShift, itself, or the applications running on OpenShift. That is covered in our OpenShift Performance Monitoring Primer.