Skip to content

Commit 1d552af

Browse files
authored
Merge pull request #30737 from mfbieber/ingress-class-name-in-example
Added ingressClassName: nginx to Ingress example
2 parents d81bc93 + e21f056 commit 1d552af

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

content/en/docs/concepts/services-networking/ingress.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ has all the information needed to configure a load balancer or proxy server. Mos
8888
contains a list of rules matched against all incoming requests. Ingress resource only supports rules
8989
for directing HTTP(S) traffic.
9090

91+
If the `ingressClassName` is omitted, a [default Ingress class](#default-ingress-class)
92+
should be defined.
93+
94+
There are some ingress controllers, that work without the definition of a
95+
default `IngressClass`. For example, the Ingress-NGINX controller can be
96+
configured with a [flag](https://kubernetes.github.io/ingress-nginx/#what-is-the-flag-watch-ingress-without-class)
97+
`--watch-ingress-without-class`. It is [recommended](https://kubernetes.github.io/ingress-nginx/#i-have-only-one-instance-of-the-ingresss-nginx-controller-in-my-cluster-what-should-i-do) though, to specify the
98+
default `IngressClass` as shown [below](#default-ingress-class).
99+
91100
### Ingress rules
92101

93102
Each HTTP rule contains the following information:
@@ -339,6 +348,14 @@ an `ingressClassName` specified. You can resolve this by ensuring that at most 1
339348
IngressClass is marked as default in your cluster.
340349
{{< /caution >}}
341350

351+
There are some ingress controllers, that work without the definition of a
352+
default `IngressClass`. For example, the Ingress-NGINX controller can be
353+
configured with a [flag](https://kubernetes.github.io/ingress-nginx/#what-is-the-flag-watch-ingress-without-class)
354+
`--watch-ingress-without-class`. It is [recommended](https://kubernetes.github.io/ingress-nginx/#i-have-only-one-instance-of-the-ingresss-nginx-controller-in-my-cluster-what-should-i-do) though, to specify the
355+
default `IngressClass`:
356+
357+
{{< codenew file="service/networking/default-ingressclass.yaml" >}}
358+
342359
## Types of Ingress
343360

344361
### Ingress backed by a single Service {#single-service-ingress}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: IngressClass
3+
metadata:
4+
labels:
5+
app.kubernetes.io/component: controller
6+
name: nginx-example
7+
annotations:
8+
ingressclass.kubernetes.io/is-default-class: "true"
9+
spec:
10+
controller: k8s.io/ingress-nginx

content/en/examples/service/networking/minimal-ingress.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
annotations:
66
nginx.ingress.kubernetes.io/rewrite-target: /
77
spec:
8+
ingressClassName: nginx-example
89
rules:
910
- http:
1011
paths:

0 commit comments

Comments
 (0)