1. Home
  2. >
  3. ColdFusion
  4. >
  5. How to use FusionReactor on Kubernetes

How to use FusionReactor on Kubernetes

Introduction

Kubernetes is a very popular container orchestration system companies use to run their docker containers in production. And many companies are migrating their ColdFusion or Lucee applications from virtual servers (i.e. using the CommandBox Docker images by Ortus Solutions) to Kubernetes. If you also use FusionReactor with your application, running your ColdFusion or Lucee application in Kubernetes, accessing it can be a challenge. And since FusionReactor is a must-have tool for monitoring and debugging ColdFusion or Lucee applications, getting access to the FusionReactor UI is essential.

The problem with accessing a FusionReactor instance running inside a Kubernetes pod, is that you do not want to create a seperate Kubernetes service for this. A Kubernetes service is used to expose services running inside the pod within the cluster and/or the public internet. Under normal circumstances, you would only expose the HTTP or HTTPS services of your pod.

This blog helps you access the FusionReactor instance from your local machine by doing a port forwarding from your Kubernetes cluster. Installing and how to use FusionReactor are out of scope for this blog. The commands that are shown are tested on Linux, but will probably be usable on Windows as well.

Requirements:

  • Kube Control (kubectl) software installed on your machine

  • Authentication for your Kubernetes cluster setup

  • Basic knowledge of the command line

  • Knowledge of your Kubernetes cluster

Setting up the prerequisites

A Kubernetes cluster can be accessed using the command line tool: kubectl. This tool communicates with the Kubernetes API and is a great tool running Kubernetes commands.

Information about how to install kubectl can be found on kubernetes.io. If you are running the managed Kubernetes on for instance Google Cloud, you will also need to install the Google Cloud SDK.

Once kubectl (and Google Cloud SDK) is installed on your computer, you will need to authenticate kubectl to have access to your Kubernetes cluster. This is dependent on the Kubernetes setup. The managed Kubernetes setups make this part easy. If you are on Google Cloud, you can use the tutorial Authenticating to the Kubernetes API server.

Getting started

With our computer ready for accessing the Kubernetes cluster from the command line, we can start accessing FusionReactor. The kubectl tool has the option to forward a local port to a port on the Pod. We know that FusionReactor uses the 8088 port, so we can forward that port from the pod to our computer using the kubectl port-forward command.

 

When executing the commands mentioned below, it’s important that you are aware of the Kubernetes namespace than your application is running in. If no namespace is defined for your application, it probably is running inside the default namespace.

 

Execute the following commands, replacing the namespace and pod name:

Get all pods in the namespace:

kubectl get pods -n <namespace>

 

Activate port-forwarding for the given pod in the given namespace:

kubectl port-forward -n <namespace> <pod_name> 8088:8088

 

Example:
kubectl port-forward -n mynamespace production-7778d54747-bcrqp 8088:8088

 

Or use (more advanced):

 

kubectl port-forward -n <namespace> $(kubectl get pods --no-headers -o custom-columns=":metadata.name" -n <namespace> | grep production-) 8088:8088

 

Example:
kubectl port-forward -n mynamespace $(kubectl get pods --no-headers -o custom-columns=":metadata.name" -n mynamespace | grep production-) 8088:8088

 

If the port-forward command is running, you should see the following (or something similar):

Forwarding from 127.0.0.1:8088 -> 8088
Forwarding from [::1]:8088 -> 8088

 

Open your web browser and surf to http://localhost:8088 on your pc to access the FusionReactor instance of your application running in Kubernetes.

 

If you see an error of some kind, please check the used namespacepod_name and/or pod prefix (in our example production- is used) and make the necessary changes.

 

Are you done with FusionReactor, then use CTRL-C key combination to end the running kubectl port-forward command.

More reading

Use Port Forwarding to Access Applications in a Cluster

You might find these articles interesting too