> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Nginx Ingress Controller

After [installing the nginx Ingress Controller](/cloud/kubernetes/networking/install-and-set-up-the-nginx-ingress-controller), create an Ingress object that defines how incoming requests are routed to a Service.

1\. Create a file named `ingress.yaml` with the following content:

```yml theme={null}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  namespace: default
spec:
  ingressClassName: nginx
  rules:
    - http:
        paths:
          - pathType: Prefix
            path: /
            backend:
              service:
                name: example-service
                port:
                  number: 80
```

The manifest defines a single routing rule for one Service. Replace the example values with values for the target service:

| Field                 | Description                                                        |
| --------------------- | ------------------------------------------------------------------ |
| `name`                | Name of the Ingress object                                         |
| `namespace`           | Namespace where the target Service runs                            |
| `ingressClassName`    | Name of the IngressClass — `nginx` for the nginx controller        |
| `path`                | URL path prefix to match incoming requests                         |
| `service.name`        | Name of the Service to route traffic to                            |
| `service.port.number` | Port exposed by the target Service that receives incoming requests |

2\. Apply the manifest:

```sh theme={null}
kubectl apply -f ingress.yaml
```

Expected output:

```sh theme={null}
ingress.networking.k8s.io/example-ingress created
```

The Ingress object is now active and the nginx Ingress Controller begins routing requests according to the configured rules.
