# Deploy a Gateway for data plane instances Type of document: How-to guide Product: NGINX Gateway Fabric --- ## Overview This document describes how to use a Gateway to deploy the NGINX data plane, and how to modify it using an NGINX custom resource. [A Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) is used to manage all inbound requests, and is a key Gateway API resource. When a Gateway is attached to a GatewayClass associated with NGINX Gateway Fabric, it creates a Service and an NGINX deployment in the same namespace as the Gateway. This forms the NGINX data plane, handling requests. A single GatewayClass can have multiple Gateways: each Gateway will create a separate Service and NGINX deployment. ## Before you begin - [Install](/ngf/install/) NGINX Gateway Fabric. ## Create a Gateway To deploy a Gateway, run the following command: ```yaml kubectl apply -f - < ``` From the information obtained with `kubectl describe` you can see the default settings for the provisioned NGINX Deployment and Service. Under `Spec.Kubernetes` you can see a few things: - The NGINX container image settings - How many NGINX Deployment replicas are specified - The type of Service and external traffic policy **Note:** Depending on installation configuration, the default NginxProxy settings may be slightly different from what is shown in the example. For more information on NginxProxy and its configurable fields, see the [API reference](/ngf/reference/api.md). Modify the NginxProxy resource to change the type of Service. Use `kubectl edit` to modify the default NginxProxy and insert the following under `spec.kubernetes.service`: ```yaml type: NodePort ``` After saving the changes, use `kubectl get` on the service, and you should see the service type has changed to `NodePort`. ```shell kubectl get service cafe-nginx ``` ```text NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE cafe-nginx NodePort 10.96.172.204 80:32615/TCP 3h5m ``` ### Set annotations and labels on provisioned resources While the majority of configuration will happen on the NginxProxy resource, that is not always the case. Uniquely, if you want to set any annotations or labels on the NGINX Deployment or Service, you need to set those annotations on the Gateway which provisioned them. You can use `kubectl edit` on the Gateway and add the following to the `spec`: ```yaml infrastructure: annotations: annotationKey: annotationValue labels: labelKey: labelValue ``` After saving the changes, check the Service and NGINX deployment with `kubectl describe`. ```shell kubectl describe deployment cafe ``` ```text Name: cafe-nginx Namespace: default CreationTimestamp: Mon, 05 May 2025 16:49:33 -0700 ... Pod Template: Labels: app.kubernetes.io/instance=ngf app.kubernetes.io/managed-by=ngf-nginx app.kubernetes.io/name=cafe-nginx gateway.networking.k8s.io/gateway-name=cafe labelKey=labelValue Annotations: annotationKey: annotationValue prometheus.io/port: 9113 prometheus.io/scrape: true ... ``` ```shell kubectl describe service cafe-nginx ``` ```text Name: cafe-nginx Namespace: default Labels: app.kubernetes.io/instance=ngf app.kubernetes.io/managed-by=ngf-nginx app.kubernetes.io/name=cafe-nginx gateway.networking.k8s.io/gateway-name=cafe labelKey=labelValue Annotations: annotationKey: annotationValue ``` ## See also For more guides on routing traffic to applications and more information on Data Plane configuration, check out the following resources: - [Routing traffic to applications](/ngf/traffic-management/basic-routing.md) - [Application routes using HTTP matching conditions](/ngf/traffic-management/advanced-routing.md) - [Data plane configuration](/ngf/how-to/data-plane-configuration.md) - [API reference](/ngf/reference/api.md)