Set up and Remotely Monitor an OpenShift Application

Updated -

In some scenarios, the user may already have a remote instance of OpenShift 3 running with various applications on it and wants to monitor it. Red Hat JBoss Developer Studio allows users to set up a connection to a remote instance of OpenShift 3 and then use logs (such as the application and build logs) to troubleshoot and monitor running applications. Use the following tasks to connect to and work with a remote OpenShift instance:

  1. Set up OpenShift Client Binaries
  2. Set up Port Forwarding
  3. Stream Pod Logs
  4. Stream Build Logs

Set up OpenShift Client Binaries

Before setting up port forwarding or streaming application and build logs, it is mandatory to set up OpenShift Client Binaries as follows:

  1. In the IDE, click Windows > Preferences > JBoss Tools > OpenShift v3.

  2. Click the here link.

  3. In the Download from GitHub section, click the Release page link.

  4. Scroll to the Downloads section and click the appropriate link to begin the client tools download for the binary for your operating system.

5 After the download is complete, extract the contents of the file.

  1. Click Windows > Preferences > JBoss Tools > OpenShift v3.

  2. Click Browse and select the location of the OpenShift Client executable file.

  3. Click Apply and then click OK.

Result: OpenShift Client Binaries are now set up for your IDE.

Set up Port Forwarding

Using the Application Port Forwarding window, you can connect the local ports to their remote counterparts to access data or debug the application.
Port forwarding automatically stops when the OpenShift connection terminates, or when the IDE is shut down or when the workspace is changed. Port forwarding must be enabled each time to connect to OpenShift from the IDE.
Prerequisite: Ensure that the OpenShift Client Binaries are set up (see Set up OpenShift Client Binaries for instructions).

Set up port forwarding as follows:

  1. In the OpenShift Explorer view, expand the connection and then expand the project, the services, and then the Pods.

  2. Right-click the relevant pod and then click Port Forwarding.

    Set up Port Forwarding

  3. In the Application Port Forwarding window, click the Find free local ports for remote ports check box.

  4. Click Start All.

Result: The Status column now shows Started, indicating that port forwarding is now active. Additionally, the Console view shows the status of port forwarding for the particular service.

Start Port Forwarding

Stream Pod Logs

Pod logs are general logs for an application running on a remote OpenShift 3 instance. The streaming application logs feature in JBoss Developer Studio is used to monitor applications and use the previous pod log to troubleshoot if the application fails or returns errors.

Prerequisite: Ensure that the OpenShift Client Binaries are set up (see Set up OpenShift Client Binaries for instructions).

To stream the application logs:

  1. In the OpenShift Explorer view, expand the project, the services, and then the Pods.

  2. Right-click the relevant Pod and then click Pod Log.

Stream Pod Log

Result: The Console view displays the Pod log.

Stream Build Logs

Build logs are logs documenting changes to applications running on a remote OpenShift 3 instance. The streaming build logs feature in JBoss Developer Studio is used to view the progress of the application build process and to debug the application.

Prerequisite: Ensure that the OpenShift Client Binaries are set up (see Set up OpenShift Client Binaries for instructions).

To stream build logs:

  1. In the OpenShift Explorer view, expand the project, the services, and then the build.

  2. Right-click the relevant build instance and click Build Log.

Stream Build Log

Result: The Console view is now the view in focus showing the build log.

Comments