# Proxy Requests to a Service

This tutorial shows how to configure a route with the Ingress Controller and verify requests through the gateway to a sample service in the cluster.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Before you begin:

* Complete [Set Up Ingress Controller and Gateway](https://docs.api7.ai/ingress-controller/set-up-ingress-controller-and-gateway.md).
* If you used API7 Dashboard, replace the example namespace `aic` with the namespace shown in the generated manifests.
* If you used API7 Dashboard, replace the example Gateway or IngressClass name `apisix` with the corresponding generated name.
* Keep shared Kubernetes API identifiers, including `apisix.apache.org` and `ApisixRoute`, unchanged.

## Deploy an Example Upstream Service[​](#deploy-an-example-upstream-service "Direct link to Deploy an Example Upstream Service")

Create the following Kubernetes manifest to deploy an [HTTPBIN](https://kennethreitz.org/software/websites/httpbin) service in the `aic` namespace:

httpbin.yaml

```
apiVersion: apps/v1

kind: Deployment

metadata:

  namespace: aic

  name: httpbin

spec:

  replicas: 1

  selector:

    matchLabels:

      app: httpbin

  template:

    metadata:

      labels:

        app: httpbin

    spec:

      containers:

      - name: httpbin

        image: kennethreitz/httpbin

        imagePullPolicy: IfNotPresent

        ports:

        - name: http

          containerPort: 80

          protocol: TCP

---

apiVersion: v1

kind: Service

metadata:

  namespace: aic

  name: httpbin

spec:

  selector:

    app: httpbin

  ports:

  - name: http

    port: 80

    protocol: TCP

    targetPort: 80

  type: ClusterIP
```

Apply the manifest:

```
kubectl apply -f httpbin.yaml
```

## Create a Route[​](#create-a-route "Direct link to Create a Route")

Create a route manifest that proxies requests to the HTTPBIN sample service:

* Gateway API
* Ingress
* APISIX CRD

httpbin-route.yaml

```
apiVersion: gateway.networking.k8s.io/v1

kind: HTTPRoute

metadata:

  namespace: aic

  name: getting-started-ip

spec:

  parentRefs:

  - name: apisix

  rules:

  - matches:

    - path:

        type: Exact

        value: /ip

    backendRefs:

    - name: httpbin

      port: 80
```

httpbin-route.yaml

```
apiVersion: networking.k8s.io/v1

kind: Ingress

metadata:

  namespace: aic

  name: getting-started-ip

spec:

  ingressClassName: apisix

  rules:

    - http:

        paths:

          - backend:

              service:

                name: httpbin

                port:

                  number: 80

            path: /ip

            pathType: Exact
```

httpbin-route.yaml

```
apiVersion: apisix.apache.org/v2

kind: ApisixRoute

metadata:

  namespace: aic

  name: getting-started-ip

spec:

  ingressClassName: apisix

  http:

    - name: getting-started-ip

      match:

        paths:

          - /ip

      backends:

        - serviceName: httpbin

          servicePort: 80
```

Apply the route manifest:

```
kubectl apply -f httpbin-route.yaml
```

## Verify Routing[​](#verify-routing "Direct link to Verify Routing")

Expose the gateway’s service port to your local machine. Use `aic` for the APISIX local setup or the namespace selected in API7 Dashboard:

```
# replace with your gateway’s service name

kubectl port-forward svc/<gateway-service-name> -n <namespace> 18080:80 &
```

The example uses local port `18080` so it can run alongside a quickstart gateway on port `9080`. If `18080` is already in use, choose another available local port and use it in the request below.

Send a request to the route:

```
curl "http://127.0.0.1:18080/ip"
```

You should receive an HTTPBIN response similar to the following. The `origin` value depends on the client address seen by HTTPBIN:

```
{

  "origin": "127.0.0.1"

}
```

## Delete the Route[​](#delete-the-route "Direct link to Delete the Route")

Delete the route:

```
kubectl delete -f httpbin-route.yaml
```

## Next Step[​](#next-step "Direct link to Next Step")

Continue to [Common Use Cases](https://docs.api7.ai/ingress-controller/common-use-cases.md) to explore plugins for traffic control, authentication, transformation, and observability.
