Skip to content

Commit 64f51e9

Browse files
committed
Add installation through manifests on openshift document
1 parent 09b7751 commit 64f51e9

File tree

1 file changed

+232
-0
lines changed

1 file changed

+232
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
---
2+
title: "Installation with Kubernetes manifests on Openshift"
3+
description: "Learn how to install, upgrade, and uninstall NGINX Gateway Fabric using Kubernetes manifests on Openshift."
4+
weight: 200
5+
toc: true
6+
docs: "DOCS-0000"
7+
---
8+
9+
{{<custom-styles>}}
10+
11+
## Prerequisites
12+
13+
To complete this guide, you'll need to install:
14+
15+
- [kubectl](https://kubernetes.io/docs/tasks/tools/), a command-line interface for managing Kubernetes clusters.
16+
17+
## Deploy NGINX Gateway Fabric
18+
19+
Deploying NGINX Gateway Fabric with Kubernetes manifests takes only a few steps. With manifests, you can configure your deployment exactly how you want. Manifests also make it easy to replicate deployments across environments or clusters, ensuring consistency.
20+
21+
- If you’d like to use NGINX Plus:
22+
1. To pull from the F5 Container registry, configure a docker registry secret using your JWT token from the MyF5 portal by following the instructions from [here](https://docs.nginx.com/nginx-gateway-fabric/installation/ngf-images/jwt-token-docker-secret). Make sure to specify the secret in the `imagePullSecrets` field of the `nginx-gateway` ServiceAccount.
23+
1. Alternatively, pull an NGINX Gateway Fabric image with NGINX Plus and push it to your private registry by following the instructions from [here]({{<relref "installation/ngf-images/pulling-ngf-image.md">}}).
24+
1. Update the nginx container's `image` field of the `nginx-gateway` Deployment accordingly.
25+
26+
### 1. Install the Gateway API resources
27+
28+
{{<include "installation/install-gateway-api-resources.md" >}}
29+
30+
### 2. Deploy the NGINX Gateway Fabric CRDs
31+
32+
#### Stable release
33+
34+
```shell
35+
kubectl apply -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/v1.2.0/deploy/crds.yaml
36+
```
37+
38+
#### Edge version
39+
40+
```shell
41+
kubectl apply -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/main/deploy/crds.yaml
42+
```
43+
44+
### 3. Deploy NGINX Gateway Fabric
45+
46+
{{<note>}}By default, NGINX Gateway Fabric is installed in the **nginx-gateway** namespace. You can deploy in another namespace by modifying the manifest files.{{</note>}}
47+
48+
#### Stable release
49+
50+
##### For NGINX
51+
52+
```shell
53+
kubectl apply -f https://github.com/nginxinc/nginx-gateway-fabric/releases/download/v1.2.0/openshift-nginx-gateway.yaml
54+
```
55+
56+
##### For NGINX Plus
57+
58+
Download the [deployment YAML](https://github.com/nginxinc/nginx-gateway-fabric/releases/download/v1.2.0/openshift-nginx-plus-gateway.yaml).
59+
60+
Update the `nginx-plus-gateway.yaml` file to include your chosen NGINX Plus image from the F5 Container registry or your custom image.
61+
62+
{{< important >}}Ensure that you [Enable Usage Reporting]({{< relref "installation/usage-reporting.md" >}}) before applying.{{< /important >}}
63+
64+
```shell
65+
kubectl apply -f nginx-plus-gateway.yaml
66+
```
67+
68+
#### Edge version
69+
70+
##### For NGINX
71+
72+
```shell
73+
kubectl apply -f deploy/manifests/openshift/nginx-gateway.yaml
74+
```
75+
76+
##### For NGINX Plus
77+
78+
{{< important >}}Ensure that you [Enable Usage Reporting]({{< relref "installation/usage-reporting.md" >}}) before applying.{{< /important >}}
79+
80+
```shell
81+
kubectl apply -f deploy/manifests/openshift/nginx-plus-gateway.yaml
82+
```
83+
84+
Update the nginx-plus-gateway.yaml file to include your chosen image from the F5 Container registry or your custom container image.
85+
86+
#### Enable experimental features
87+
88+
We support a subset of the additional features provided by the Gateway API experimental channel. To enable the experimental features of Gateway API which are supported by NGINX Gateway Fabric:
89+
90+
##### For NGINX
91+
92+
```shell
93+
kubectl apply -f deploy/manifests/openshift/nginx-gateway-experimental.yaml
94+
```
95+
96+
##### For NGINX Plus
97+
98+
```shell
99+
kubectl apply -f deploy/manifests/openshift/nginx-plus-gateway-experimental.yaml
100+
```
101+
102+
Update the nginx-plus-gateway-experimental.yaml file to include your chosen image from the F5 Container registry or your custom container image.
103+
104+
{{<note>}}Requires the Gateway APIs installed from the experimental channel.{{</note>}}
105+
106+
### 4. Verify the Deployment
107+
108+
To confirm that NGINX Gateway Fabric is running, check the pods in the `nginx-gateway` namespace:
109+
110+
```shell
111+
kubectl get pods -n nginx-gateway
112+
```
113+
114+
The output should look similar to this (note that the pod name will include a unique string):
115+
116+
```text
117+
NAME READY STATUS RESTARTS AGE
118+
nginx-gateway-5d4f4c7db7-xk2kq 2/2 Running 0 112s
119+
```
120+
121+
## Upgrade NGINX Gateway Fabric
122+
123+
{{<tip>}}For guidance on zero downtime upgrades, see the [Delay Pod Termination](#configure-delayed-pod-termination-for-zero-downtime-upgrades) section below.{{</tip>}}
124+
125+
To upgrade NGINX Gateway Fabric and get the latest features and improvements, take the following steps:
126+
127+
1. **Upgrade Gateway API resources:**
128+
129+
- Verify that your NGINX Gateway Fabric version is compatible with the Gateway API resources. Refer to the [Technical Specifications]({{< relref "reference/technical-specifications.md" >}}) for details.
130+
- Review the [release notes](https://github.com/kubernetes-sigs/gateway-api/releases) for any important upgrade-specific information.
131+
- To upgrade the Gateway API resources, run:
132+
133+
```shell
134+
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml
135+
```
136+
137+
or, if you installed the from the experimental channel:
138+
139+
```shell
140+
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/experimental-install.yaml
141+
```
142+
143+
1. **Upgrade NGINX Gateway Fabric CRDs:**
144+
145+
- To upgrade the Custom Resource Definitions (CRDs), run:
146+
147+
```shell
148+
kubectl apply -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/v1.2.0/deploy/crds.yaml
149+
```
150+
151+
1. **Upgrade NGINX Gateway Fabric deployment:**
152+
153+
- To upgrade the deployment, run:
154+
155+
```shell
156+
kubectl apply -f https://github.com/nginxinc/nginx-gateway-fabric/releases/download/v1.2.0/openshift-nginx-gateway.yaml
157+
```
158+
159+
## Delay pod termination for zero downtime upgrades {#configure-delayed-pod-termination-for-zero-downtime-upgrades}
160+
161+
{{< include "installation/delay-pod-termination/delay-pod-termination-overview.md" >}}
162+
163+
Follow these steps to configure delayed pod termination:
164+
165+
1. Open the `nginx-gateway.yaml` for editing.
166+
167+
1. **Add delayed shutdown hooks**:
168+
169+
- In the `nginx-gateway.yaml` file, add `lifecycle: preStop` hooks to both the `nginx` and `nginx-gateway` container definitions. These hooks instruct the containers to delay their shutdown process, allowing time for connections to close gracefully. Update the `sleep` value to what works for your environment.
170+
171+
```yaml
172+
<...>
173+
name: nginx-gateway
174+
<...>
175+
lifecycle:
176+
preStop:
177+
exec:
178+
command:
179+
- /usr/bin/gateway
180+
- sleep
181+
- --duration=40s # This flag is optional, the default is 30s
182+
<...>
183+
name: nginx
184+
<...>
185+
lifecycle:
186+
preStop:
187+
exec:
188+
command:
189+
- /bin/sleep
190+
- "40"
191+
<...>
192+
```
193+
194+
1. **Set the termination grace period**:
195+
196+
- {{<include "installation/delay-pod-termination/termination-grace-period.md">}}
197+
198+
1. Save the changes.
199+
200+
{{<see-also>}}
201+
For additional information on configuring and understanding the behavior of containers and pods during their lifecycle, refer to the following Kubernetes documentation:
202+
203+
- [Container Lifecycle Hooks](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks)
204+
- [Pod Lifecycle](https://kubernetes.io/docs/concepts/workloads/Pods/Pod-lifecycle/#Pod-termination)
205+
206+
{{</see-also>}}
207+
208+
## Uninstall NGINX Gateway Fabric
209+
210+
Follow these steps to uninstall NGINX Gateway Fabric and Gateway API from your Kubernetes cluster:
211+
212+
1. **Uninstall NGINX Gateway Fabric:**
213+
214+
- To remove NGINX Gateway Fabric and its custom resource definitions (CRDs), run:
215+
216+
```shell
217+
kubectl delete -f https://github.com/nginxinc/nginx-gateway-fabric/releases/download/v1.2.0/openshift-nginx-gateway.yaml
218+
```
219+
220+
```shell
221+
kubectl delete -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/v1.2.0/deploy/crds.yaml
222+
```
223+
224+
1. **Remove the Gateway API resources:**
225+
226+
- {{<include "installation/uninstall-gateway-api-resources.md" >}}
227+
228+
## Next steps
229+
230+
### Expose NGINX Gateway Fabric
231+
232+
{{<include "installation/next-step-expose-fabric.md">}}

0 commit comments

Comments
 (0)