Skip to content

Flex Gateway Setup

This guide walks through the process of deploying MuleSoft Flex Gateway on a Kubernetes cluster. Flex Gateway serves as an API gateway that can be deployed in various environments to manage and secure API traffic.

Prerequisites

Before beginning the installation, ensure you have:

  • Docker installed and running
  • Kubernetes cluster with access configured
  • Helm installed (v3+)
  • Organization ID and registration token from Anypoint Platform
  • Sufficient permissions to create resources in your Kubernetes cluster

These tools are essential for downloading the gateway image, registering with Anypoint Platform, and deploying to Kubernetes.

Download the Flex Gateway Image

First, verify Docker is running properly:

docker info

Then pull the latest Flex Gateway image:

docker pull mulesoft/flex-gateway:latest

This downloads the official MuleSoft Flex Gateway container image to your local Docker registry.

Register Flex Gateway

Create a directory to store registration files:

mkdir flex-registration

Navigate to the registration directory:

cd flex-registration

Register the gateway with Anypoint Platform:

docker run --entrypoint flexctl -u $UID \
  -v "$(pwd)":/registration mulesoft/flex-gateway \
  registration create --organization=47a69cfc-93a0-4f10-a4c5-02eb88748bfd \
  --token=3ce41bd2-c137-42ba-90c8-ca92b18f17bf \
  --output-directory=/registration \
  --connected=true \
  safran-cluster

This command registers your gateway instance with Anypoint Platform. The registration process creates configuration files in your current directory that will be used during deployment. The --connected=true flag configures the gateway to run in connected mode, maintaining communication with Anypoint Platform.

Add a Repository for the Helm Chart

Add the Flex Gateway Helm repository:

helm repo add flex-gateway https://flex-packages.anypoint.mulesoft.com/helm

Update your Helm repositories:

helm repo up

These commands add the MuleSoft Helm repository to your local Helm configuration and ensure you have the latest version of the charts.

Deploy and Connect Flex Gateway

Deploy Flex Gateway to your Kubernetes cluster:

helm -n gateway upgrade -i --create-namespace --wait ingress flex-gateway/flex-gateway \
  --set-file registration.content=registration.yaml \
  --set gateway.mode=connected \
  --set gateway.scope=Namespace \
  --set service.enabled=true \
  --set service.type=ClusterIP \
  --set ingressClass.enabled=false

This Helm command deploys Flex Gateway with the following configuration: - Creates a namespace called gateway if it doesn't exist - Names the release ingress - Uses the registration file created earlier - Sets the gateway to run in connected mode - Configures the gateway to operate at namespace scope - Creates a Kubernetes service of type ClusterIP - Disables the creation of an IngressClass resource

Verify the Installation

Check that the Flex Gateway pods are running:

kubectl -n gateway get pods

Verify the service was created:

kubectl -n gateway get svc

Check the logs for any issues:

kubectl -n gateway logs -l app.kubernetes.io/name=flex-gateway

These commands help confirm that Flex Gateway deployed successfully and is running properly in your cluster.