Skip to content

Commit 8be9aa1

Browse files
authored
Merge pull request #181 from nginxinc/update-doc
Update docs and examples
2 parents bfc6a53 + ea3f021 commit 8be9aa1

File tree

8 files changed

+97
-30
lines changed

8 files changed

+97
-30
lines changed

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,23 @@ We provide the following extensions to our Ingress controller:
3030
* [SSL Services](examples/ssl-services), which allows you to load balance HTTPS applications.
3131
* [Rewrites](examples/rewrites), which allows you to rewrite the URI of a request before sending it to the application.
3232
* [Session Persistence](examples/session-persistence) (NGINX Plus only), which guarantees that all the requests from the same client are always passed to the same backend container.
33+
* [Support for JWTs](examples/jwt) (NGINX Plus only), which allows NGINX Plus to authenticate requests by validating JSON Web Tokens (JWTs).
3334

34-
Additionally, we provide a mechanism to customize the NGINX configuration. Refer to the [examples folder](examples) to find out how to [deploy](examples/complete-example) the Ingress controller and [customize](examples/customization) the NGINX configuration.
35+
Additional extensions as well as a mechanism to customize NGINX configuration are available. See [examples/customization](examples/customization).
3536

3637
## Benefits of Using the Ingress Controller with NGINX Plus
3738

3839
[NGINX Plus](https://www.nginx.com/products/) is a commercial version of NGINX that comes with advanced features and support.
3940

4041
The Ingress controller leverages the advanced features of NGINX Plus, which gives you the following additional benefits:
4142

42-
* **Reduced number of configuration reloads**
43-
Every time the number of pods of services you expose via Ingress changes, the Ingress controller updates the configuration of NGINX to reflect those changes. For the open source NGINX software, the configuration file must be changed and the configuration reloaded. For NGINX Plus, the [on-the-fly reconfiguration](https://www.nginx.com/products/on-the-fly-reconfiguration/) feature is utilized, which allows NGINX Plus to be updated on-the-fly without reloading the configuration. This prevents a potential increase of memory usage and overall system overloading, which could occur with too frequent configuration reloads.
43+
* **Improved system resources utilization for large-scale deployments**
44+
Every time the number of pods of services you expose via Ingress changes, the Ingress controller updates the configuration of NGINX to reflect those changes. For the open source NGINX software, the configuration file must be changed and the configuration reloaded. For NGINX Plus, the [on-the-fly reconfiguration](https://www.nginx.com/products/on-the-fly-reconfiguration/) feature is utilized, which allows NGINX Plus to be updated on-the-fly without reloading the configuration. This prevents increase of memory usage during reloads, especially with a high volume of client requests, as well as increased memory usage when load balancing applications with long-lived connections (WebSocket, applications with file uploading/downloading or streaming). As a result, NGINX Plus Ingress controller is better suited for production-ready deployments.
4445
* **Real-time statistics**
4546
NGINX Plus provides you with [advanced statistics](https://www.nginx.com/products/live-activity-monitoring/), which you can access either through the API or via the built-in dashboard. This can give you insights into how NGINX Plus and your applications are performing.
4647
* **Session persistence** When enabled, NGINX Plus makes sure that all the requests from the same client are always passed to the same backend container using the *sticky cookie* method. Refer to the [session persistence examples](examples/session-persistence) to find out how to configure it.
48+
* **JWTs** NGINX Plus can validate JSON Web Tokens (JWTs), providing a flexible authentication mechanism.
49+
* **Support** Support from NGINX Inc is available for NGINX Plus Ingress controller.
4750

4851
**Note**: Deployment of the Ingress controller for NGINX Plus requires you to do one extra step: build your own [Docker image](nginx-controller) using the certificate and key for your subscription.
4952
The Docker image of the Ingress controller for NGINX is [available on Docker Hub](https://hub.docker.com/r/nginxdemos/nginx-ingress/).
@@ -52,21 +55,12 @@ The Docker image of the Ingress controller for NGINX is [available on Docker Hub
5255

5356
You can run multiple Ingress controllers at the same time. For example, if your Kubernetes cluster is deployed in cloud, you can run the NGINX controller and the corresponding cloud HTTP load balancing controller. Refer to the [example](examples/multiple-ingress-controllers) to learn more.
5457

55-
## Advanced Load Balancing (Beyond Ingress)
58+
## Advanced Load Balancing/An Alternative Method of Configuration
5659

57-
When your requirements go beyond what Ingress offers, you can use NGINX and
58-
NGINX Plus without the Ingress Controller.
60+
When your requirements go beyond what Ingress and Ingress extensions offer or if you are looking for an alternative method of configuring NGINX, it is possible to use NGINX or NGINX Plus without the Ingress Controller.
5961

6062
NGINX Plus comes with a [DNS-based dynamic reconfiguration feature](https://www.nginx.com/blog/dns-service-discovery-nginx-plus/), which lets you keep the list of the endpoints of your services in sync with NGINX Plus. Read more about how to setup NGINX Plus this way in [Load Balancing Kubernetes Services with NGINX Plus](https://www.nginx.com/blog/load-balancing-kubernetes-services-nginx-plus/).
6163

62-
## Production Status
63-
64-
This is the preview version of the Ingress controller.
65-
66-
## Support
67-
68-
Support from the [NGINX Professional Services Team](https://www.nginx.com/services/) is available when using the NGINX Plus Ingress controller.
69-
7064
## Contacts
7165

7266
We’d like to hear your feedback! If you have any suggestions or experience issues with our Ingress controller, please create an issue or send a pull request on Github.

examples/customization/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ The table below summarizes some of the options. More options (extensions) are av
3535
| `nginx.org/location-snippets` | `location-snippets` | Sets a custom snippet in location context. | N/A |
3636
| `nginx.org/server-snippets` | `server-snippets` | Sets a custom snippet in server context. | N/A |
3737
| `nginx.org/lb-method` | `lb-method` | Sets the [load balancing method](https://www.nginx.com/resources/admin-guide/load-balancer/#method). The default `""` specifies the round-robin method. | `""` |
38+
| `nginx.org/listen-ports` | N/A | Configures HTTP ports that NGINX will listen on. | `[80]` |
39+
| `nginx.org/listen-ports-ssl` | N/A | Configures HTTPS ports that NGINX will listen on. | `[443]` |
3840

3941
## Using ConfigMaps
4042

examples/daemon-set/README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,29 @@
22

33
You can deploy the NGINX or NGINX Plus controller as a [Daemon Set](http://kubernetes.io/docs/admin/daemons/). This allows you to deploy the controller on all or select nodes of your cluster.
44

5-
To deploy the NGINX controller, run:
6-
```
7-
$ kubectl create -f nginx-ingress.yaml
8-
```
5+
1. Create a Secret with an SSL certificate and key for the default server of NGINX/NGINX Plus. It is recommended that you use your own certificate and key.
6+
```
7+
$ kubectl create -f default-server-secret.yaml
8+
```
99
10-
To deploy the NGINX Plus controller, run:
11-
```
12-
$ kubectl create -f nginx-plus-ingress.yaml
13-
```
10+
1. To deploy the NGINX controller, run:
11+
```
12+
$ kubectl create -f nginx-ingress.yaml
13+
```
14+
To deploy the NGINX Plus controller, run:
15+
```
16+
$ kubectl create -f nginx-plus-ingress.yaml
17+
```
1418
1519
Once deployed, by default, a controller pod is running on every node of the cluster. The pods are accessible through ports 80 and 443 of each node they get scheduled on.
1620
1721
Optionally, you can choose to run the controller pods on only select nodes. To accomplish this:
1822
1. Add a label to each node on which you want to run a controller pod. For example:
19-
```
20-
kubectl label node node-1 role=nginx-ingress
21-
kubectl label node node-2 role=nginx-ingress
22-
```
23-
where *node-1* and *node-2* are some nodes of your cluster.
23+
```
24+
kubectl label node node-1 role=nginx-ingress
25+
kubectl label node node-2 role=nginx-ingress
26+
```
27+
where *node-1* and *node-2* are some nodes of your cluster.
2428
2529
1. Uncomment the **nodeSelector** related lines (11-12) in the corresponding daemon set yaml file and specify a label to use to select nodes (`role=nginx-ingress` in this example).
2630
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: default-server-secret
5+
type: Opaque
6+
data:
7+
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURTVENDQWpHZ0F3SUJBZ0lKQUs5L2NDNWZocDJHTUEwR0NTcUdTSWIzRFFFQkJRVUFNQ0V4SHpBZEJnTlYKQkFNVEZrNUhTVTVZU1c1bmNtVnpjME52Ym5SeWIyeHNaWEl3SGhjTk1UY3dPRE14TVRBeE16UTRXaGNOTVRndwpPRE14TVRBeE16UTRXakFoTVI4d0hRWURWUVFERXhaT1IwbE9XRWx1WjNKbGMzTkRiMjUwY205c2JHVnlNSUlCCklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF0bXhhMDhadExIaWxleWhOUWN5OUl4ankKWTBYdy9CRmZvM3duMDRsSXRoaGRxbkZ3NTZIVG1RVjIvbnEyRUxMdTNoejNjc3Urc3M5WFEzL3BrbXVwTEE5TApuaVVRZFVNcER4VlE1VFFKRW5CanJ5aXc4RWFlcEp4NU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lLc0wxNG13R2dxODZRdDhxeTIwcWw4RFNyWG91TmhsQTJmL1ZUTk1SMAp2OXAwU1JrQjI2UVYyUitndnNVYk9xb1lhMlVQVkNuQW9QeTYwTXlBaVJUR3cyeTExbm9lCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

examples/daemon-set/nginx-ingress.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ spec:
1919
hostPort: 80
2020
- containerPort: 443
2121
hostPort: 443
22+
env:
23+
- name: POD_NAMESPACE
24+
valueFrom:
25+
fieldRef:
26+
fieldPath: metadata.namespace
2227
# Uncomment the lines below to enable extensive logging and/or customization of
2328
# NGINX configuration with configmaps
24-
#args:
29+
args:
2530
#- -v=3
26-
#- -nginx-configmaps=default/nginx-config
31+
#- -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
32+
- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret

examples/daemon-set/nginx-plus-ingress.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@ spec:
1919
hostPort: 80
2020
- containerPort: 443
2121
hostPort: 443
22+
env:
23+
- name: POD_NAMESPACE
24+
valueFrom:
25+
fieldRef:
26+
fieldPath: metadata.namespace
2227
# Uncomment the lines below to enable extensive logging and/or customization of
2328
# NGINX configuration with configmaps
2429
args:
2530
- -nginx-plus
2631
#- -v=3
27-
#- -nginx-configmaps=default/nginx-config
32+
#- -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
33+
- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret

examples/jwt/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Support for JSON Web Tokens (JWTs)
2+
3+
NGINX Plus supports validating JWTs with [ngx_http_auth_jwt_module](http://nginx.org/en/docs/http/ngx_http_auth_jwt_module.html).
4+
5+
The Ingress controller provides the following 4 annotations for configuring JWT validation:
6+
7+
* Required: ```nginx.com/jwt-key: "secret"``` -- specifies a Secret resource with keys for validating JWTs. The keys must be stored in the `jwk` data field.
8+
* Optional: ```nginx.com/jwt-realm: "realm"``` -- specifies a realm.
9+
* Optional: ```nginx.com/jwt-token: "token"``` -- specifies a variable that contains JSON Web Token. By default, a JWT is expected in the `Authorization` header as a Bearer Token.
10+
* Optional: ```nginx.com/jwt-login-url: "url"``` -- specifies a URL to which a client is redirected in case of an invalid or missing JWT.
11+
12+
## Example
13+
14+
In the following example we enable JWT validation for the cafe-ingress Ingress:
15+
```yaml
16+
apiVersion: extensions/v1beta1
17+
kind: Ingress
18+
metadata:
19+
name: cafe-ingress
20+
annotations:
21+
nginx.com/jwt-key: "cafe-jwk"
22+
nginx.com/jwt-realm: "Cafe App"
23+
nginx.com/jwt-token: "$cookie_auth_token"
24+
nginx.com/jwt-login-url: "https://login.example.com"
25+
spec:
26+
tls:
27+
- hosts:
28+
- cafe.example.com
29+
secretName: cafe-secret
30+
rules:
31+
- host: cafe.example.com
32+
http:
33+
paths:
34+
- path: /tea
35+
backend:
36+
serviceName: tea-svc
37+
servicePort: 80
38+
- path: /coffee
39+
backend:
40+
serviceName: coffee-svc
41+
servicePort: 80
42+
```
43+
* The keys must be deployed separately in the Secret `cafe-jwk`.
44+
* The realm is `Cafe App`.
45+
* The token is extracted from the `auth_token` cookie.
46+
* The login URL is `https://login.example.com`.

nginx-controller/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ There are other cases when you need to build your own image. For example if you
1515
Before you can build the image, make sure that the following software is installed on your machine:
1616
* [Docker](https://www.docker.com/products/docker)
1717
* [GNU Make](https://www.gnu.org/software/make/)
18+
* [OpenSSL](https://www.openssl.org/), optionally, if you would like to generate a self-signed certificate and a key for the default server.
1819

1920
Additionally, for NGINX Plus, you must have the NGINX Plus license. If you don't have one, you can sign up for a [free 30-day trial](https://www.nginx.com/free-trial-request/). Put the certificate (`nginx-repo.crt`) and the key (`nginx-repo.key`) of your license inside this folder.
2021

0 commit comments

Comments
 (0)