@@ -372,6 +372,63 @@ To enable [Ingress NGINX](https://github.com/kubernetes/ingress-nginx), an
372
372
Ingress controller for Kubernetes using NGINX as a reverse proxy and load
373
373
balancer, it is sufficient to declare :
374
374
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
+
375
432
` ` ` yaml
376
433
k8s_ingress_nginx_enable: true
377
434
k8s_ingress_nginx_services:
0 commit comments