Update docs for new ingress api in cluster version >=1.19 (#7264)
* Update docs to support Ingress in cluster version 1.19 or greater * Update docs * Update basic-usage.md * Update basic-usage.md
This commit is contained in:
parent
638a93835a
commit
37fbcc0bd9
1 changed files with 48 additions and 0 deletions
|
@ -49,6 +49,54 @@ spec:
|
|||
When you apply this yaml, 2 ingress resources will be created managed by the **ingress-nginx** instance. Nginx is configured to automatically discover all ingress with the `kubernetes.io/ingress.class: "nginx"` annotation.
|
||||
Please note that the ingress resource should be placed inside the same namespace of the backend resource.
|
||||
|
||||
If cluster version >= 1.19 the Ingress resource above will not work.
|
||||
You need to deploy the following so that it match the new api version.
|
||||
This will require changes to the Ingress objects as shown below, and a new object from type "kind: IngressClass"
|
||||
```
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ingress-myservicea
|
||||
spec:
|
||||
rules:
|
||||
- host: myservicea.foo.org
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: myservicea
|
||||
port:
|
||||
number: 80
|
||||
ingressClassName: nginx
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ingress-myserviceb
|
||||
spec:
|
||||
rules:
|
||||
- host: myserviceb.foo.org
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: myserviceb
|
||||
port:
|
||||
number: 80
|
||||
ingressClassName: nginx
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: IngressClass
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
controller: k8s.io/ingress-nginx
|
||||
```
|
||||
|
||||
On many cloud providers ingress-nginx will also create the corresponding Load Balancer resource. All you have to do is get the external IP and add a DNS `A record` inside your DNS provider that point myServiceA.foo.org and myServiceB.foo.org to the nginx external IP. Get the external IP by running:
|
||||
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue