|
| 1 | +--- |
| 2 | +title: Install NGINX Gateway Fabric on OpenShift |
| 3 | +description: Deploy F5 NGINX Gateway Fabric on Red Hat OpenShift through OperatorHub and configure it using the NginxGatewayFabric custom resource. |
| 4 | +weight: 400 |
| 5 | +toc: true |
| 6 | +nd-content-type: how-to |
| 7 | +nd-product: NGF |
| 8 | +--- |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +This guide details how to install F5 NGINX Gateway Fabric on Red Hat OpenShift through OperatorHub. You can then configure it with the `NginxGatewayFabric` custom resource. |
| 13 | + |
| 14 | +## Before you begin |
| 15 | + |
| 16 | +Before starting, we recommend you have the following: |
| 17 | + |
| 18 | +- A running Red Hat OpenShift cluster with cluster administrator privileges. |
| 19 | +- Ability to pull images from `ghcr.io` (or a mirrored registry if required by your environment). |
| 20 | + |
| 21 | +- Optional integrations |
| 22 | + - F5 NGINX One dataplane API key if you plan to integrate with [F5 NGINX One Console](https://docs.nginx.com/nginx-one/). |
| 23 | + - F5 NGINX Plus entitlements if you plan to run NGINX Gateway Fabric with F5 NGINX Plus. |
| 24 | + |
| 25 | +NGINX Gateway Fabric provides first-class OpenShift support with Universal Base Image (UBI)-based images. Use the `-ubi` tags shown in the custom resource definition (CRD) examples. Defaults are compatible with OpenShift Security Context Constraints (SCCs) for non-root operation. If your cluster enforces custom SCCs or policies, bind the appropriate SCC to NGINX Gateway Fabric service accounts. |
| 26 | + |
| 27 | +This section covers the necessary steps to have NGINX Gateway Fabric fully running in an OpenShift environment when installing through the OperatorHub |
| 28 | + |
| 29 | +## Install NGINX Gateway Fabric Operator from OperatorHub |
| 30 | + |
| 31 | + 1. Navigate to the Red Hat Catalog: https://catalog.redhat.com/en |
| 32 | + 1. Search for "NGINX Gateway Fabric Operator" in the searchbar at the top |
| 33 | + 1. Select NGINX Gateway Fabric Operator |
| 34 | + 1. Select **Deploy & use** |
| 35 | + 1. Choose the appropriate architecture and release tag |
| 36 | + 1. Complete the installation. Wait until the Operator status shows Installed |
| 37 | + |
| 38 | +## Create a project |
| 39 | + |
| 40 | +In your cluster, create a dedicated project (namespace) for NGINX Gateway Fabric components. |
| 41 | + |
| 42 | +```shell |
| 43 | +oc new-project nginx-gateway-fabric |
| 44 | +``` |
| 45 | + |
| 46 | +## Create TLS secrets for internal communication (optional) |
| 47 | + |
| 48 | +If you want NGINX Gateway Fabric to auto-generate internal certificates, skip this step. To provide your own TLS secrets, create the following: |
| 49 | + |
| 50 | +Agent TLS (used by internal agent) |
| 51 | + |
| 52 | +```shell |
| 53 | +oc create secret tls agent-tls \ |
| 54 | + --cert=agent.crt \ |
| 55 | + --key=agent.key \ |
| 56 | + -n nginx-gateway-fabric |
| 57 | +``` |
| 58 | + |
| 59 | +Server TLS (used by internal server) |
| 60 | + |
| 61 | +```shell |
| 62 | +oc create secret tls server-tls \ |
| 63 | + --cert=server.crt \ |
| 64 | + --key=server.key \ |
| 65 | + -n nginx-gateway-fabric |
| 66 | +``` |
| 67 | + |
| 68 | +## Create the NginxGatewayFabric custom resource |
| 69 | + |
| 70 | +1. Navigate to the "Installed Operators" section and select the "NGINX Gateway Fabric" Operator |
| 71 | +1. To create a new `NginxGatewayFabric` resource, select the tab labeled "NginxGatewayFabric" |
| 72 | +1. Next, select "Create NginxGatewayFabric" |
| 73 | +1. In this menue you will see "Forum view" and "YAML view". Select "YAML view" |
| 74 | +1. You will now see a YAML configuration for the `NginxGatewayFabric` resource |
| 75 | +1. Near the bottom, press the "Create" button |
| 76 | + |
| 77 | +## Integrate with NGINX One Console (optional) |
| 78 | + |
| 79 | +If you want to use NGINX One Console to monitor NGINX Gateway Fabric, create a secret for the dataplane key (replace VALUE with your key). |
| 80 | + |
| 81 | +```shell |
| 82 | +oc create secret generic nginxone-dataplane-key \ |
| 83 | + --from-literal=key=VALUE \ |
| 84 | + -n nginx-gateway-fabric |
| 85 | +``` |
| 86 | + |
| 87 | +Reference this secret in `spec.nginx.nginxOneConsole.dataplaneKeySecretName` in your `NginxGatewayFabric` resource. |
| 88 | + |
| 89 | +## Configure NGINX Plus licensing (optional) |
| 90 | + |
| 91 | +If you plan to use NGINX Plus, set `spec.nginx.plus: true` in your `NginxGatewayFabric` resource. Add image pull credentials, and create a license secret if needed. |
| 92 | + |
| 93 | +Example license secret name referenced by `usage.secretName` |
| 94 | + |
| 95 | +```shell |
| 96 | +oc create secret generic nplus-license \ |
| 97 | + --from-file=nginx-repo.crt=/path/to/nginx-repo.crt \ |
| 98 | + --from-file=nginx-repo.key=/path/to/nginx-repo.key \ |
| 99 | + -n nginx-gateway-fabric |
| 100 | +``` |
| 101 | + |
| 102 | +## Configure exposure options for OpenShift (optional) |
| 103 | + |
| 104 | +Choose one exposure option: |
| 105 | + |
| 106 | +If a LoadBalancer is available, set `spec.nginx.service.type: LoadBalancer`. Optionally set: |
| 107 | + |
| 108 | +- `externalTrafficPolicy: Local` to preserve client source IPs. |
| 109 | +- `loadBalancerClass`, `loadBalancerIP`, and `loadBalancerSourceRanges` per your environment. |
| 110 | + |
| 111 | +If a LoadBalancer is not available, set `spec.nginx.service.type: NodePort`, then create an OpenShift Route to the NGINX Gateway Fabric front-end Service (for HTTP/HTTPS traffic): |
| 112 | + |
| 113 | +```shell |
| 114 | +oc create route edge ngf \ |
| 115 | + --service=nginx-gateway-fabric-nginx \ |
| 116 | + --port=http \ |
| 117 | + -n nginx-gateway-fabric |
| 118 | +``` |
| 119 | + |
| 120 | +For TLS passthrough, add `--passthrough` and target the appropriate Service port. |
| 121 | + |
| 122 | +## Validate the installation |
| 123 | + |
| 124 | +Verify that deployments and services are running, and confirm the GatewayClass: |
| 125 | + |
| 126 | +```shell |
| 127 | +oc get pods -n nginx-gateway-fabric |
| 128 | +oc get svc -n nginx-gateway-fabric |
| 129 | +oc get gatewayclass |
| 130 | +``` |
| 131 | + |
| 132 | +If troubleshooting is required, review logs |
| 133 | + |
| 134 | +Controller logs |
| 135 | + |
| 136 | +```shell |
| 137 | +oc logs deploy/ngf-nginx-gateway -n nginx-gateway-fabric |
| 138 | +``` |
| 139 | + |
| 140 | +Data plane logs |
| 141 | + |
| 142 | +```shell |
| 143 | +oc logs deploy/ngf-nginx -n nginx-gateway-fabric |
| 144 | +``` |
| 145 | + |
| 146 | +## Perform a functional check (optional) |
| 147 | + |
| 148 | +Create a Gateway and HTTPRoute to validate routing: |
| 149 | + |
| 150 | +```yaml |
| 151 | +apiVersion: gateway.networking.k8s.io/v1 |
| 152 | +kind: Gateway |
| 153 | +metadata: |
| 154 | + name: http |
| 155 | + namespace: nginx-gateway-fabric |
| 156 | +spec: |
| 157 | + gatewayClassName: nginx |
| 158 | + listeners: |
| 159 | + - name: http |
| 160 | + port: 80 |
| 161 | + protocol: HTTP |
| 162 | + hostname: example.com |
| 163 | + allowedRoutes: |
| 164 | + namespaces: |
| 165 | + from: Same |
| 166 | +--- |
| 167 | +apiVersion: gateway.networking.k8s.io/v1 |
| 168 | +kind: HTTPRoute |
| 169 | +metadata: |
| 170 | + name: echo |
| 171 | + namespace: nginx-gateway-fabric |
| 172 | +spec: |
| 173 | + parentRefs: |
| 174 | + - name: http |
| 175 | + hostnames: |
| 176 | + - example.com |
| 177 | + rules: |
| 178 | + - backendRefs: |
| 179 | + - name: echo |
| 180 | + port: 8080 |
| 181 | +``` |
| 182 | +
|
| 183 | +Ensure you have a Service and Deployment named `echo` that expose port 8080. If you are using a LoadBalancer Service, send a request to the load balancer IP address. Otherwise, use an OpenShift Route as configured. |
| 184 | + |
| 185 | +## See also |
| 186 | + |
| 187 | +- [Red Hat Catalog](https://catalog.redhat.com/en) |
| 188 | +- [Install NGINX Gateway Fabric with Helm]({{< ref "/ngf/install/helm.md" >}}) |
| 189 | +- [Secure certificates for NGINX Gateway Fabric]({{< ref "/ngf/install/secure-certificates.md" >}}) |
0 commit comments