How to use Node-RED Operator on Red Hat OpenShift
I’m Kazuhito Yokoi at OSS Solution Center in Hitachi, Ltd. In this article, I will explain how to use Node-RED on OpenShift. Thanks to the OpenShift web console, users can easily deploy the Node-RED environment without command-line operations even if they are beginners. Recently, the Node-RED operator has been available on the OpenShift catalog as below.
As of December 2020, there are four items in the catalog. Let’s deploy “Node-RED operator” from them to the OpenShift environment on the Katacoda.
(1) Access OpenShift web console
Firstly, access the OpenShift Playground 4.6 via the following URL. This playground environment is available for 60 minutes only because it is the free environment to try the OpenShift.
After clicking the red “START SCENARIO” button on the welcome sidebar, you can see the terminal which is able to handle the OpenShift environment using the command-line. To open the OpenShift web console in the other browser window, click the external link on the console tab next to the terminal tab. While you are using the web console, you always need to keep the previous terminal open because the Katacoda environment will be closed unintentionally if there is no terminal window.
To login to the web console, type the “admin” for both the Username and Password fields.
(2) Install Node-RED Operator
As the next step, let us install the Node-RED operator on the web console. To setup the operator, select “Operators” -> “OperatorHub” on the left side menu. Once the text field is filled by the “node-red” word as the keyword, you will see two Node-RED operators, the operator with the “Marketplace” tag and another operator with no tag. In this procedure, click the first Node-RED operator without the “Marketplace” tag because the operator with the “Marketplace” tag seems to need a purchase.
Next, click the “Install” buttons using the default settings.
The installation process takes about one minute. After completing it, the installation status will be changed from “Installing operator” to “Installed operator — ready for use”.
(3) Deploy Node-RED container
After the installation status becomes “Installed operator — ready for use”, change the account from “Administrator to “Developer”. In the developer role, you will be able to deploy the Node-RED container from the catalog.
After clicking the “+Add” item in the left menu, select “openshift-operators” in the Project pull-down menu and then move to the “From catalog” item.
As you can see in the following screenshot, three items have emerged in the catalog. Click the “Node-RED” item from the three. (Because documentation has not been enough, the usages of “Backup Node-RED” and “Restore Node-RED” containers are not clear currently.)
On the deployment settings, select “YAML View” to change the default values.
In the YAML view, you need to modify two values in the `adminpassword` and `enabled` value for persistent volume as follows.
The `adminpassword` is the hash value of the login password for the Node-RED flow editor. The hash value which was newly pasted to YAML View means “password”. If you would like to know the details of the method to generate an original hash value, see the Node-RED official document. In the Katacoda environment, the `enabled` value should be `false` because Storage Class is not available.
After pushing the “Create” button, the view of the web console will be switched to the topology view. In this view, you can see the progress of the deployment using the color of the circle for the instances. If the deployment has been done successfully, the ring of the Node-RED instance will be turned blue within about two minutes.
On the blue ring of the instance, there is the external button to open the Node-RED flow editor. (If you interested in the URL of the Node-RED instance, click the blue ring to open the detail sidebar. You can see the URL of the Node-RED instance in the Routes field of the sidebar.) Once open the new browser tab by this external button, you can see the login UI. To login to the Node-RED flow editor, input “admin” as username and “password” as password.
The deployed Node-RED instance can be accessible from the Internet. To avoid access without permission, the Node-RED instance has equipped a log-in UI to admit pre-defined users only.
Node-RED flow editor which was created by the Node-RED operator has enabled the project feature as the default. In this procedure, the feature to put the flow data on a git repository is not necessary. Therefore, you can avoid git settings by clicking the “Not right now” button.
From now, you can use the Node-RED flow editor as usual. As an example, I used the inject node and debug node to check behaviors.
In this article, I explained that it is easy for beginner users to deploy the Node-RED environment on Red Hat OpenShift using Operator. I think that the benefit of the OpenShift environment is versatile components on catalog like GitLab, MySQL, and other middleware that can connect to Node-RED. To describe this merit of the OpenShift, I’m going to write the next article about integrating Node-RED with the Docker container which contains the TensorFlow model.