This article is a part of the series "Hands-On With Apache APISIX Ingress."

Other articles in the series:

I recently came across an APISIX user trying to access a service outside the Kubernetes cluster through their Ingress. There could be multiple scenarios where someone might want to do that:

  1. Hybrid environments: You can have a part of your application running inside a Kubernetes cluster and another outside it or even on a different cloud environment. In scenarios where such setup is inevitable, routing traffic from the cluster to these external services might be needed.
  2. Legacy systems: While migrating to Kubernetes from a legacy system, you might still have some services on the latter to avoid downtime. An Ingress can route traffic to these legacy systems until they are fully migrated to Kubernetes.
  3. Third-party services: Your application might need to access third-party services outside the cluster. Using your Ingress to route traffic to and between your cluster and such externally hosted service could be helpful in such scenarios.
Accessing External Services through APISIX Ingress
Accessing External Services through APISIX Ingress

The external service could be legacy systems, applications in hybrid environments, or third-party services.

There could be even more use cases where this might be helpful. In this short article, I will explain how you can configure this in APISIX Ingress.

Before you move on, ensure you have deployed APISIX and APISIX Ingress controller in your Kubernetes cluster.

Example Setup

We will deploy APISIX Ingress in Kubernetes and configure it to route to an externally deployed instance of HTTPBin.

Example setup
Example setup

A simple setup to demonstrate how to configure accessing external services in APISIX Ingress.

Configuring the External Service

Once you have APISIX and the APISIX Ingress controller running in your cluster, you can use the custom CRDs (why?) provided by APISIX for configuration.

First, we configure an upstream resource that contains the details of the external service we are accessing. To do this, we can create an ApisixUpstream resource as shown below:

kind: ApisixUpstream
  name: httpbin-upstream
    - type: Domain

This will configure as the upstream. The type Domain indicates that this is a third-party service.

Routing to the External Service

Once you have configured the upstream to point to the external service, we can create a route to use this upstream. This can be configured through the ApisixRoute CRD:

kind: ApisixRoute
  name: httpbin-route
    - name: httpbin-route
          - /*
        - name: httpbin-upstream

This will create a route that matches all requests with the header and forwards it to httpbin-upstream, the externally deployed HTTPBin.

Now, if we send a request to APISIX, it will be routed to the external HTTPBin service:

curl -H ''
  "args": {},
  "data": "",
  "files": {},
  "form": {},
  "headers": {
    "Accept": "*/*",
    "Host": "",
    "User-Agent": "curl/8.1.2",
    "X-Amzn-Trace-Id": "Root=1-65326ab6-6187e69f6e6afjd59e34e601",
    "X-Forwarded-Host": ""
  "json": null,
  "method": "GET",
  "origin": ",",
  "url": ""

What’s Next?

You can also learn more about using APISIX in Kubernetes from the official documentation. If you want to see more articles on specific topics, please reach out to me at

See the complete list of articles in the series “Hands-On With Apache APISIX Ingress”.