Skip to content

Commit 2885caa

Browse files
authored
Update Basic configuration documentation (#7531)
This commit changes the example YAML code block to single-source the contents from the actual GitHub code. It also updates some parts of the page structure to match contemporary style conventions.
1 parent 7c5371c commit 2885caa

File tree

1 file changed

+20
-38
lines changed

1 file changed

+20
-38
lines changed

site/content/configuration/ingress-resources/basic-configuration.md

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,15 @@
11
---
2-
docs: DOCS-593
3-
doctypes:
4-
- ''
52
title: Basic configuration
6-
toc: true
73
weight: 100
4+
toc: true
5+
type: reference
6+
product: NIC
7+
docs: DOCS-593
88
---
99

1010
This document shows a basic Ingress resource definition for F5 NGINX Ingress Controller. It load balances requests for two services as part of a single application.
1111

12-
```yaml
13-
apiVersion: networking.k8s.io/v1
14-
kind: Ingress
15-
metadata:
16-
name: cafe-ingress
17-
spec:
18-
tls:
19-
- hosts:
20-
- cafe.example.com
21-
secretName: cafe-secret
22-
rules:
23-
- host: cafe.example.com
24-
http:
25-
paths:
26-
- path: /tea
27-
pathType: Prefix
28-
backend:
29-
service:
30-
name: tea-svc
31-
port:
32-
number: 80
33-
- path: /coffee
34-
pathType: Prefix
35-
backend:
36-
service:
37-
name: coffee-svc
38-
port:
39-
number: 80
40-
```
12+
{{< ghcode `https://raw.githubusercontent.com/nginx/kubernetes-ingress/refs/heads/main/examples/ingress-resources/complete-example/cafe-ingress.yaml`>}}
4113

4214
Here is a breakdown of what this Ingress resource definition means:
4315

@@ -55,6 +27,7 @@ To learn more about the Ingress resource, view [the official Kubernetes document
5527

5628
{{< note >}} For complete instructions on deploying Ingress and Secret resources in the cluster, see the [complete example](https://github.com/nginx/kubernetes-ingress/tree/v{{< nic-version >}}/examples/ingress-resources/complete-example) in the GitHub repository. {{< /note >}}
5729

30+
---
5831

5932
## New features available in Kubernetes 1.18
6033

@@ -63,7 +36,7 @@ Starting from Kubernetes 1.18, you can use the following new features:
6336
- The host field supports wildcard domain names, such as `*.example.com`.
6437
- The path supports different matching rules with the new field `pathType`, which takes the following values: `Prefix` for prefix-based matching, `Exact` for exact matching and `ImplementationSpecific`, which is the default type and is the same as `Prefix`. For example:
6538

66-
```yaml
39+
```yaml {hl_lines=[2, 7, 14]}
6740
- path: /tea
6841
pathType: Prefix
6942
backend:
@@ -87,7 +60,7 @@ Starting from Kubernetes 1.18, you can use the following new features:
8760
8861
- The `ingressClassName` field is now supported:
8962

90-
```yaml
63+
```yaml {hl_lines=[6]}
9164
apiVersion: networking.k8s.io/v1
9265
kind: Ingress
9366
metadata:
@@ -105,6 +78,8 @@ Starting from Kubernetes 1.18, you can use the following new features:
10578

10679
When using this field you need to create the `IngressClass` resource with the corresponding `name`. View the [Create common resources]({{< relref "installation/installing-nic/installation-with-manifests.md#create-common-resources" >}}) section of the Installation with Manifests topic for more information.
10780

81+
---
82+
10883
## Restrictions
10984

11085
NGINX Ingress Controller imposes the following restrictions on Ingress resources:
@@ -114,12 +89,19 @@ NGINX Ingress Controller imposes the following restrictions on Ingress resources
11489
- The `path` field in `spec.rules[].http.paths[]` is required for `Exact` and `Prefix` `pathTypes`.
11590
- The ImplementationSpecific `pathType` is treated as equivalent to `Prefix` `pathType`, with the exception that when this `pathType` is configured, the `path` field in `spec.rules[].http.paths[]` is not mandatory. `path` defaults to `/` if not set but the `pathType` is set to ImplementationSpecific.
11691

92+
---
93+
11794
## Advanced configuration
11895

119-
NGINX Ingress Controller generates NGINX configuration by executing a template file that contains the configuration options. These options are set with the Ingress resource and NGINX Ingress Controller's ConfigMap. The Ingress resource only allows you to use basic NGINX features: host and path-based routing and TLS termination.
96+
NGINX Ingress Controller generates NGINX configuration by executing a template file that contains the configuration options.
97+
98+
These options are set with the Ingress resource and NGINX Ingress Controller's ConfigMap.
99+
100+
The Ingress resource only allows you to use basic NGINX features: host and path-based routing and TLS termination.
120101

121-
Advanced features like rewriting the request URI or inserting additional response headers are available through annotations. View the [Advanced configuration with Annotations]({{< relref "configuration/ingress-resources/advanced-configuration-with-annotations.md" >}}) topic for more information.
102+
For advanced configuration, you have two options:
122103

123-
Advanced NGINX users who require more control over the generated NGINX configurations can use snippets to insert raw NGINX config. View the [Advanced configuration with Snippets]({{< relref "configuration/ingress-resources/advanced-configuration-with-snippets" >}}) topic for more information.
104+
- [Annotations]({{< ref "/configuration/ingress-resources/advanced-configuration-with-annotations.md" >}}) can be used to rewrite request URIs or inserting additional response headers.
105+
- [Snippets]({{< ref "/configuration/ingress-resources/advanced-configuration-with-snippets" >}}) can be used to insert raw NGINX configuration, changing generated files.
124106

125107
Additionally, it is possible to customize the template, described in the [Custom templates]({{< relref "/configuration/global-configuration/custom-templates.md" >}}) topic.

0 commit comments

Comments
 (0)