+

Getting Started with Runtime Fabric on Red Hat OpenShift

30 min read
Was this tutorial helpful?
Thank you for your feedback!

This tutorial was updated in September 2022 and is based on Runtime Fabric v1.10 release.

We would like to thank Sadhana Nandakumar for their contribution to this developer tutorial.

In this tutorial, we’ll walk you through deploying an example Mule application to a Red Hat OpenShift cluster using Runtime Fabric. You’ll learn how to:

  • Setup the OpenShift container platform
  • Create Runtime Fabric
  • Install Runtime Fabric on Red Hat OpenShift
  • Setup an ingress
  • Deploy and test a simple Mule app to run on your new cluster

To get started as simply and quickly as possible, this tutorial includes steps to create Red Hat OpenShift cluster, nodes and a Runtime Fabric instance with default settings. Before creating a cluster, nodes and a Runtime Fabric instance for production use, we recommend that you familiarize yourself with all settings and deploy settings that meet your requirements. For more information, see the Red Hat OpenShift documentation. For detailed Runtime Fabric documentation see Anypoint Runtime Fabric Overview.


Prerequisites

  • Anypoint Platform - We’ll need an Anypoint Platform account to create our Runtime Fabric service. You can sign up for a free trial account here - However, you will need an enterprise account to have access to Runtime Fabric from Runtime Manager.
  • OpenShift CLI - A command line tool for working with Kubernetes clusters. This tutorial requires that you use version 4.x or later. See installing oc.
  • curl - A command line tool for transferring data using various network protocols. See installing curl.

In order to successfully deploy Mule applications to Runtime Fabric you also need:

  • An OpenShift cluster - It is possible to set up a fully-managed or self-managed Red Hat OpenShift cluster on bare metal or a public cloud provider. Check out this page to obtain a trial license for Red Hat OpenShift. To learn about how to set up Red Hat OpenShift check out the documentation here.
  • A valid enterprise licence – Your MuleSoft account representative will help you acquire an Enterprise licence in the form of a licence.lic file.

Setup the OpenShift Container Platform

1 - An OpenShift cluster can be set up on bare metal, virtual machines, or a cloud provider (GCP, Azure, AWS). Check out this page to obtain a trial license for Red Hat OpenShift. To learn about how to set up Red Hat OpenShift check out the documentation here. Ensure that you have cluster-admin privileges on the OpenShift cluster.

2 - The OpenShift web console provides a graphical user interface to manage the projects on the OpenShift cluster. Once the OpenShift cluster is installed and ready, log in to the OpenShift web console using the admin credentials, set up during the cluster installation.

Login to OpenShift

3 - The Openshift command line interface allows the creation and management of projects on the cluster using a terminal. To login to the OpenShift command line, click on the Copy login command under the user profile drop-down menu, click on Display Token and paste it to a terminal.

OpenShift Copy Command

You should now be logged in to the OpenShift command line.

OpenShift CLI Login

Create Runtime Fabric

1 - Navigate to Anypoint Platform and log in.

2 - From the home page navigate to Runtime Manager.

Anypoint Platform Runtime Manager Home

3 - Click Runtime Fabrics then Create Runtime Fabric.

Anypoint Platform Create Runtime Fabric

4 - Create a deployment target for Mule apps you want to deploy. In this case we’re using the name runtime-fabric-openshift. Select OpenShift Container Platform and click Next.

Anypoint Platform Create OpenShift Runtime Fabric

5 - Review the Support responsibility disclaimer, then if you agree click Accept.

6 - This page displays the instructions and the activation data used to install Runtime Fabric on OpenShift.

Install Runtime Fabric

1 - The first step is to create a namespace, which provides a mechanism to scope resources in a cluster. The Openshift command line interface allows the creation and management of projects on the cluster using a terminal. Create a namespace by copying the OpenShift command specified on the Runtime Fabric page on Anypoint Platform.

Anypoint Platform Copy Operator

Create Namespace

2 - Next, a pull secret needs to be created for pulling the docker images from the Runtime Fabric registry. Copy the next OpenShift command from the Runtime Fabric page to create the pull secret.

Pull Secret

CLI Pull Secret

3 - Now, the Runtime Fabric operator can be installed on the cluster. Red Hat OpenShift Operators automates the creation, configuration, and management of Kubernetes-native applications. Operators can be managed using the Openshift web console, which provides an alternate mechanism to create and manage projects on the cluster.

With the certified Anypoint Runtime Fabric operator you can easily deploy and manage containerized MuleSoft applications. To install the Runtime Fabric Operator, open up the Operator Hub from the left side navigation pane and search.

Red Hat RTF

4 - Once the operator is installed, it can be configured with the activation data to register it to the Anypoint platform. Copy the activation data from the Runtime Fabric page on the Anypoint platform. Note that a Mule license is required to deploy applications to the Runtime Fabric.Check out this link to learn more about how you can create a base64 encoded string from the license file.

Red Hat Register

Red Hat Activation

The registration process takes a few minutes to complete. Once done the status of the Runtime Fabric can be verified on the Anypoint platform.

5 - Refresh the Runtime Fabric page on the Anypoint platform. It should now show the status of the Runtime Fabric installed on OpenShift.

Anypoint Platform Success

Configure ingress controller

OpenShift 4.7 includes a built-in ingress controller operator. Create a ingress template using the configuration below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
  name: rtf-ingress
  namespace: rtf
  labels:
    mule-environment: environment-id
    mule-business-group: business-group-id
spec:
  ingressClassName: rtf-openshift-default
  rules:
  - host: app-name.router-internal-default.apps-crc.testing
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: service
            port:
              number: 80

The host needs to be changed to the domain name of the OpenShift cluster that is used.

The template can be created using the following OpenShift command.

1
oc create -f ingress_template.yaml

Deploy Mule application

1 - Deploy the sample application. In Anypoint Platform click Applications then Deploy Application

Anypoint Platform Deploy

2 - Enter a unique name customer-api as the Application Name, select the runtime-fabric-openshift as our Deployment Target then click Import File from Exchange to select Upload File. We will upload a customer api Mule application jar.

Anypoint Platform Target

3 - Clicking Deploy Application will deploy the customer-api Mule application to your Runtime Fabric environment.

Anypoint Platform Deployment

4 - Notice that an ingress has been set up and we can now use it to invoke the api.

CLI Test

Next Steps

In this tutorial we walked you through deploying an example Mule application to a Red Hat OpenShift cluster using Runtime Fabric. You learned how to:

  • Setup the OpenShift container platform
  • Create Runtime Fabric
  • Install Runtime Fabric on Red Hat OpenShift
  • Setup an ingress
  • Deploy and test a simple Mule app to run on your new cluster

Click on the Next button below to continue to the next tutorial in this series that configures TLS and last-mile security.

Next

Runtime Fabric also runs as a service on Amazon Elastic Kubernetes Service (Amazon EKS), Azure Kubernetes Service (AKS) and Google Kubernetes Engine (GKE). Check out their tutorials below.

Try Anypoint Platform for free

Start free trial