|
6 | 6 |
|
7 | 7 | <br/>
|
8 | 8 |
|
| 9 | + |  |  |
| 10 | +--- | --- | --- |
| 11 | + |
| 12 | +<br/> |
| 13 | + |
9 | 14 | ## Pre-Requisites
|
10 | 15 |
|
11 | 16 | - Working kubernetes cluster, with admin privleges
|
12 |
| -- Running nginx-ingress controller, either OSS or Plus. This install guide follows the instructions for deploying an Nginx Ingress Controller here: https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/ |
| 17 | +- Running nginx-ingress controller, either OSS or Plus. This install guide followed the instructions for deploying an Nginx Ingress Controller here: https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/ |
13 | 18 | - Demo application, this install guide uses the Nginx Cafe example, found here: https://github.com/nginxinc/kubernetes-ingress/tree/main/examples/ingress-resources/complete-example
|
14 | 19 | - A bare metal Linux server or VM for the external LB Server, connected to a network external to the cluster. Two of these will be required if High Availability is needed, as shown here.
|
15 | 20 | - Nginx Plus software loaded on the LB Server(s). This install guide follows the instructions for installing Nginx Plus on Centos 7, located here: https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus/
|
|
19 | 24 |
|
20 | 25 | ## Kubernetes Cluster
|
21 | 26 |
|
| 27 | +<br/> |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +<br/> |
| 32 | + |
22 | 33 | A standard K8s cluster is all that is required. There must be enough resources available to run the Nginx Ingress Controller, and the Nginx Kubernetes Loadbalancer Controller. You must have administrative access to be able to create the namespace, services, and deployments for this Solution. This Solution was tested on Kubernetes version 1.23. Most recent versions => v1.21 should work just fine.
|
23 | 34 |
|
24 | 35 | <br/>
|
25 | 36 |
|
26 | 37 | ## Nginx Ingress Controller
|
27 | 38 |
|
| 39 | +<br/> |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +<br/> |
| 44 | + |
28 | 45 | The Nginx Ingress Controller in this Solution is the destination target for traffic (north-south) that is being sent to the cluster. The installation of the actual Ingress Controller is outside the scope of this installation guide, but we include the links to the docs for your reference. `The NIC installation must follow the documents exactly as written,` as this Solution refers to the `nginx-ingress` namespace and service objects. **Only the very last step is changed.**
|
29 | 46 |
|
30 |
| -NOTE: This Solution only works with nginx-ingress from Nginx. It will `not` work with the Community version of Ingress, called ingress-nginx. If you are unsure which Ingress Controller you are running, check out the blog on Nginx.com: |
| 47 | +NOTE: This Solution only works with nginx-ingress from Nginx. It will `not` work with the Community version of Ingress, called ingress-nginx. |
| 48 | + |
| 49 | +If you are unsure which Ingress Controller you are running, check out the blog on Nginx.com: |
31 | 50 | https://www.nginx.com/blog/guide-to-choosing-ingress-controller-part-4-nginx-ingress-controller-options
|
32 | 51 |
|
33 | 52 |
|
@@ -62,23 +81,35 @@ spec:
|
62 | 81 |
|
63 | 82 | ```
|
64 | 83 |
|
| 84 | +Apply the updated nodeport-nkl.yaml Manifest: |
65 | 85 |
|
66 | 86 | ```bash
|
67 | 87 | kubectl apply -f nodeport-nkl.yaml
|
68 | 88 | ```
|
69 | 89 |
|
| 90 | +<br/> |
70 | 91 |
|
| 92 | +## Demo Application |
71 | 93 |
|
72 | 94 | <br/>
|
73 | 95 |
|
74 |
| -## Demo Application |
| 96 | + |
75 | 97 |
|
76 |
| -This is not part of the actual Solution, but it is useful to have a well-known application running in the cluster, as a useful target for test commands. The example provided here is used by the Solution to demonstrate proper traffic flows, and application health check monitoring, to determine if the application is running in the cluster. If you choose a different Application to test with, the health checks provided here will NOT work, and will need to be modified to work correctly. |
| 98 | +<br/> |
| 99 | + |
| 100 | +This is not part of the actual Solution, but it is useful to have a well-known application running in the cluster, as a known-good target for test commands. The example provided here is used by the Solution to demonstrate proper traffic flows, as well as application health check monitoring, to determine if the application is running in the cluster. |
| 101 | + |
| 102 | +Note: If you choose a different Application to test with, `the Nginx health checks provided here will NOT work,` and will need to be modified to work correctly. |
77 | 103 |
|
78 | 104 | - Deploy the Nginx Cafe Demo application, found here:
|
79 | 105 |
|
80 | 106 | https://github.com/nginxinc/kubernetes-ingress/tree/main/examples/ingress-resources/complete-example
|
81 | 107 |
|
| 108 | +- The Cafe Demo Docker image used is an upgraded one, with graphics and additional Request and Response variables added. |
| 109 | + |
| 110 | +https://hub.docker.com/r/nginxinc/ingress-demo |
| 111 | +You can use the `cafe.yaml` manifest included. |
| 112 | + |
82 | 113 | - Do not use the `cafe-ingress.yaml` file. Rather, use the `cafe-virtualserver.yaml` file that is provided here. It uses the Nginx CRDs to define a VirtualServer, and the related Routes and Redirects needed. The `redirects are required` for the LB Server's health checks to work correctly!
|
83 | 114 |
|
84 | 115 | ```yaml
|
@@ -143,21 +174,30 @@ spec:
|
143 | 174 |
|
144 | 175 | ## Linux VM or bare-metal LB Server
|
145 | 176 |
|
146 |
| -This is a standard Linux OS system, based on the Linux Distro and Technical Specs required for Nginx Plus, which can be found here: https://docs.nginx.com/nginx/technical-specs/ |
| 177 | + |
| 178 | +
|
147 | 179 |
|
148 |
| -This installation guide followed the "Installation of Nginx Plus on Centos/Redhat/Oracle" steps for installing Nginx Plus. |
| 180 | +This is any standard Linux OS system, based on the Linux Distro and Technical Specs required for Nginx Plus, which can be found here: https://docs.nginx.com/nginx/technical-specs/ |
| 181 | +
|
| 182 | +This Solution followed the "Installation of Nginx Plus on Centos/Redhat/Oracle" steps for installing Nginx Plus. |
149 | 183 |
|
150 | 184 | >NOTE: This solution will not work with Nginx OpenSource, as OpenSource does not have the API that is used in this Solution. Installation on unsupported Distros is not recommended or supported.
|
151 | 185 |
|
152 | 186 | <br/>
|
153 | 187 |
|
154 | 188 | ## Nginx Plus LB Server
|
155 | 189 |
|
| 190 | +<br/> |
| 191 | +
|
| 192 | + |
| 193 | +
|
| 194 | +<br/> |
| 195 | +
|
156 | 196 | This is the configuration required for the LB Server, external to the cluster. It must be configured for the following.
|
157 | 197 |
|
158 | 198 | - Move the Nginx default Welcome page from port 80 to port 8080. Port 80 will be used by the stream context, instead of the http context.
|
159 | 199 | - API write access enabled on port 9000.
|
160 |
| -- Plus Dashboard enabled, used for testing, monitoring, and visualization of the solution working. |
| 200 | +- Plus Dashboard enabled, used for testing, monitoring, and visualization of the Solution working. |
161 | 201 | - The `Stream` context is enabled, for TCP loadbalancing.
|
162 | 202 | - Stream context is configured.
|
163 | 203 |
|
@@ -202,13 +242,13 @@ server {
|
202 | 242 |
|
203 | 243 | 
|
204 | 244 |
|
205 |
| -- Create a new folder for the stream config .conf files. /etc/nginx/stream was used in this Solution. |
| 245 | +- Create a new folder for the stream config .conf files. /etc/nginx/stream is used in this Solution. |
206 | 246 |
|
207 | 247 | ```bash
|
208 | 248 | mkdir /etc/nginx/stream
|
209 | 249 | ```
|
210 | 250 |
|
211 |
| -- Create 2 new `STATE` files for Nginx. These are used to backup the configuration, in case Nginx restarts/reloads. |
| 251 | +- Create 2 new `STATE` files for Nginx. These are used to backup the Upstream configuration, in case Nginx is restarted/reloaded. |
212 | 252 |
|
213 | 253 | Nginx State Files Required for Upstreams
|
214 | 254 | - state file /var/lib/nginx/state/nginx-lb-http.state
|
@@ -289,7 +329,7 @@ stream {
|
289 | 329 |
|
290 | 330 | `Notice that is uses Ports 80 and 443.`
|
291 | 331 |
|
292 |
| - Place this file in the /etc/nginx/stream folder. |
| 332 | + Place this file in the /etc/nginx/stream folder, and reload Nginx. Notice the match block and health check directives are for the cafe.example.com Demo application from Nginx. |
293 | 333 |
|
294 | 334 | ```bash
|
295 | 335 | # NginxK8sLB Stream configuration, for L4 load balancing
|
@@ -338,6 +378,11 @@ stream {
|
338 | 378 |
|
339 | 379 | <br/>
|
340 | 380 |
|
| 381 | + |
| 382 | + |
| 383 | +<br/> |
| 384 | + |
| 385 | + |
341 | 386 | This is the new Controller, which is configured to watch the k8s environment, the nginx-ingress Service object, and send API updates to the Nginx LB Server when there are changes. It only requires three things.
|
342 | 387 |
|
343 | 388 | - New kubernetes namespace and RBAC
|
|
0 commit comments