Loading

Configure a single ingress resource object to serve all flex gateway requests

Publiceringsdatum: Jul 25, 2025
Uppgift

You have several APIs using the same port with unique base paths configured and would like to configure a single ingress resource object to serve all requests.

Steg

SYMPTOM

You have several APIs using the same port with unique base paths configured and would like to configure a single ingress resource object to serve all requests. 

SOLUTION

Disclaimer: This article involves products and technologies which do not form part of the MuleSoft product set. Technical assistance for such products is limited to this article.

NOTE: This article will have examples using the NGINX ingress controller and is meant to provide guidance. You will need to adjust the examples as necessary to suite your environment and ingress controller. 

Step 1: Ensure you have installed Flex Gateway with service.type=ClusterIP and service.http.port=8081
$ helm -n gateway upgrade -i --create-namespace --wait ingress flex-gateway/flex-gateway \
  --set-file registration.content=registration.yaml \
  --set gateway.mode=connected
  --set service.type=ClusterIP
  --set service.http.port=8081

Step 2: Ensure that your k8s environment has the NGINX ingress controller installed. You can find the documentation regarding this here. Please reach out to your vendor or k8s administrator for assistance.

Step 3: Create number of APIs to API Manager for Flex Gateway from API Manager ensuring that the same port is used (example: 8081) but unique Base Path is specified. Visit our developer site for tutorials on getting started with Flex Gateway here. Please find a basic representation of example UI values for the two APIs below. For more information, please review the documentation.
---
Implementation URI: https://<upstream address>:443
Base path: /api1
Port: 8081
---
Implementation URI: https://<upstream address>:443
Base path: /api2
Port: 8081
---

Step 4: Create an ingress resource in the namespace the flex gateway ingress pod was installed in. For, example:
cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
  name: ingress-resource
  namespace: gateway
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          service:
            name: ingress
            port:
              number: 8081
        path: /
        pathType: Prefix
EOF

Step 5: Obtain your ingress controller IP and test requests. For example:
$ curl http://<ingressControllerIP>/api1/users/1 -H "Host: example.com"
{
  "id": 1,
  "name": "Leanne Graham",
  "username": "Bret",
  "email": "Sincere@april.biz",
  "address": {
    "street": "Kulas Light",
    "suite": "Apt. 556",
    "city": "Gwenborough",
    "zipcode": "92998-3874",
    "geo": {
      "lat": "-37.3159",
      "lng": "81.1496"
    }
  },
  "phone": "1-770-736-8031 x56442",
  "website": "hildegard.org",
  "company": {
    "name": "Romaguera-Crona",
    "catchPhrase": "Multi-layered client-server neural-net",
    "bs": "harness real-time e-markets"
  }

$ curl http://<ingressControllerIP>/api2/users/1 -H "Host: example.com"
{
  "id": 1,
  "name": "Leanne Graham",
  "username": "Bret",
  "email": "Sincere@april.biz",
  "address": {
    "street": "Kulas Light",
    "suite": "Apt. 556",
    "city": "Gwenborough",
    "zipcode": "92998-3874",
    "geo": {
      "lat": "-37.3159",
      "lng": "81.1496"
    }
  },
  "phone": "1-770-736-8031 x56442",
  "website": "hildegard.org",
  "company": {
    "name": "Romaguera-Crona",
    "catchPhrase": "Multi-layered client-server neural-net",
    "bs": "harness real-time e-markets"
  }

Disclaimer: This article involves products and technologies which do not form part of the MuleSoft product set. Technical assistance for such products is limited to this article.
Knowledge-artikelnummer

001117079

 
Laddar
Salesforce Help | Article