Skip to content

Commit 8996922

Browse files
committed
Bump Ingress NGINX to 1.10.0 & enable haproxy mode
This updates Ingress NGINX yaml to version 1.10.0 and enable the usage in haproxy, so that every node will expose 80 and 443 for the ingress controller.
1 parent 6d5030f commit 8996922

File tree

5 files changed

+179
-53
lines changed

5 files changed

+179
-53
lines changed

README.md

+57
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,63 @@ To enable [Ingress NGINX](https://github.com/kubernetes/ingress-nginx), an
372372
Ingress controller for Kubernetes using NGINX as a reverse proxy and load
373373
balancer, it is sufficient to declare:
374374

375+
```yaml
376+
k8s_ingress_nginx_enable: true
377+
```
378+
379+
This will install the Ingress NGINX controller that can be used for different
380+
purposes.
381+
382+
#### Ingress NGINX on control-planes
383+
384+
For example it is possible to use Ingress NGINX by exposing the `80` and `443`
385+
ports on the balanced IP managed by haproxy, by declaring this:
386+
387+
```yaml
388+
k8s_ingress_nginx_enable: true
389+
k8s_ingress_nginx_haproxy_conf: true
390+
k8s_ingress_nginx_services:
391+
- name: ingress-nginx-externalip
392+
spec:
393+
externalIPs:
394+
- 192.168.122.199
395+
ports:
396+
- name: port-1
397+
port: 80
398+
protocol: TCP
399+
- name: port-2
400+
port: 443
401+
protocol: TCP
402+
selector:
403+
app.kubernetes.io/component: controller
404+
app.kubernetes.io/instance: ingress-nginx
405+
app.kubernetes.io/name: ingress-nginx
406+
```
407+
408+
This will expose both ports on the balanced IP (in this case `192.168.122.199`
409+
and will make the service responding there.
410+
411+
To test it just try this:
412+
413+
```console
414+
$ kubectl create deployment demo --image=httpd --port=80
415+
deployment.apps/demo created
416+
417+
$ kubectl expose deployment demo
418+
service/demo exposed
419+
420+
$ kubectl create ingress demo --class=nginx --rule="demo.192.168.122.199.nip.io/*=demo:80"
421+
ingress.networking.k8s.io/demo created
422+
423+
$ curl http://demo.192.168.122.199.nip.io
424+
<html><body><h1>It works!</h1></body></html>
425+
```
426+
427+
#### Ingress NGINX with MetalLB
428+
429+
Another way is to use it in combination with MetalLB, by declaring a
430+
`LoadBalancer` service, as follows:
431+
375432
```yaml
376433
k8s_ingress_nginx_enable: true
377434
k8s_ingress_nginx_services:

defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ k8s_metallb_ports:
112112
k8s_metallb_pools: {}
113113

114114
k8s_ingress_nginx_enable: false
115+
k8s_ingress_nginx_haproxy_conf: false
115116
k8s_ingress_nginx_namespace: ingress-nginx
116117
k8s_ingress_nginx_services: {}
117118

0 commit comments

Comments
 (0)