Skip to content

Commit

Permalink
Bump Ingress NGINX to 1.10.0 & enable haproxy mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rascasoft committed Mar 15, 2024
1 parent 6d5030f commit 8996922
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 53 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,63 @@ To enable [Ingress NGINX](https://github.com/kubernetes/ingress-nginx), an
Ingress controller for Kubernetes using NGINX as a reverse proxy and load
balancer, it is sufficient to declare:

```yaml
k8s_ingress_nginx_enable: true
```

This will install the Ingress NGINX controller that can be used for different
purposes.

#### Ingress NGINX on control-planes

For example it is possible to use Ingress NGINX by exposing the `80` and `443`
ports on the balanced IP managed by haproxy, by declaring this:

```yaml
k8s_ingress_nginx_enable: true
k8s_ingress_nginx_haproxy_conf: true
k8s_ingress_nginx_services:
- name: ingress-nginx-externalip
spec:
externalIPs:
- 192.168.122.199
ports:
- name: port-1
port: 80
protocol: TCP
- name: port-2
port: 443
protocol: TCP
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
```

This will expose both ports on the balanced IP (in this case `192.168.122.199`
and will make the service responding there.

To test it just try this:

```console
$ kubectl create deployment demo --image=httpd --port=80
deployment.apps/demo created
$ kubectl expose deployment demo
service/demo exposed
$ kubectl create ingress demo --class=nginx --rule="demo.192.168.122.199.nip.io/*=demo:80"
ingress.networking.k8s.io/demo created
$ curl http://demo.192.168.122.199.nip.io
<html><body><h1>It works!</h1></body></html>
```

#### Ingress NGINX with MetalLB

Another way is to use it in combination with MetalLB, by declaring a
`LoadBalancer` service, as follows:

```yaml
k8s_ingress_nginx_enable: true
k8s_ingress_nginx_services:
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ k8s_metallb_ports:
k8s_metallb_pools: {}

k8s_ingress_nginx_enable: false
k8s_ingress_nginx_haproxy_conf: false
k8s_ingress_nginx_namespace: ingress-nginx
k8s_ingress_nginx_services: {}

Expand Down
Loading

0 comments on commit 8996922

Please sign in to comment.