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:
1
docker info
Then pull the latest Flex Gateway image:
1
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:
1
mkdir flex-registration
Navigate to the registration directory:
1
cd flex-registration
Register the gateway with Anypoint Platform:
1
2
3
4
5
6
7
docker run --entrypoint flexctl -u $UID \
-v "$(pwd)":/registration mulesoft/flex-gateway \
registration create --organization=<organization_id> \
--token=3ce41bd2-c137-42ba-90c8-ca92b18f17bf \
--output-directory=/registration \
--connected=true \
<cluster_name>
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=trueflag 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:
1
helm repo add flex-gateway https://flex-packages.anypoint.mulesoft.com/helm
Update your Helm repositories:
1
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:
1
2
3
4
5
6
7
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
gatewayif 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:
1
kubectl -n gateway get pods
Verify the service was created:
1
kubectl -n gateway get svc
Check the logs for any issues:
1
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.