Understanding ingress-nginx

Cluster information:

Kubernetes version: 1.33.2
Host OS: Debian (VM)
CNI and version: 0.27.1 (flannel 1.7.1)
CRI and version: 1.33.0
###############

Hi,

Sorry for my english, I’m french.

I’m new to Kubernetes, which I learned on my own by following tutorials.
I installed a cluster with 1 master and 2 workers on VMs for some web applications and mariaDB. I created some deployments, cronjobs, jobs, configmaps, secrets and services and everything works.
My applications are accessible using my personal domain with specifics ports (ex: my-domain.fr:1234).

But now I would like to use ingress-nginx.
My goal is to access my applications using my-domain.fr without specifying a port (ex: app1.my-domain.fr for application1 with port 1234, app2.my-domain.fr for application2 with port 2345, etc…).

For trying to understand and put in place ingress-nginx I’ve found a lot of tutorials, some with simple example, but nothing work even by following the tutorials to the letter.

Thank’s for your help and advice.

You’re on the right track to using Ingress-Nginx! Great tool for managing external access to your Kubernetes services.

Ingress-Nginx acts as an edge router or reverse proxy for your Kubernetes cluster. Instead of exposing individual service ports, you expose a single entry point (typically ports 80 for HTTP and 443 for HTTPS) through Ingress-Nginx. When a request comes in, Ingress-Nginx inspects the hostname (e.g., app1.my-domain.fr) and the path, then routes the request to the appropriate internal Kubernetes service.

That’s what I understood.
But when I try to put in place ingress-nginx using tutorials it doesn’t work.
Actually I use a reverse proxy on one of my physical servers (Raspberry) to route the request. It works but I would prefer use ingress-nginx instead.
I will try another time, perhaps I missed or forgot something.

Here are 2 tests that I performed.

  • Test A:
    1 - Created 2 deployments with apache2 installed and working on HTTP (modified basic index.html page on both to know where I end up): test-ingress-app1 & test-ingress-app2
    2 - Creation of 2 NodePort type services, 1 for each deployment
    ==> Accessing http://<master_IP>: on each of the 2 nodeports takes me to the right place

  • Test B:
    (use URL test.my-domain.fr created at my domain name provider)
    1 - Modification of HTTP routing on the internet box (to the master instead of the physical reverse proxy)
    2 - Creation of 2 ClusterIP type services for each deployment
    3 - Creating an ingress with rules:

host: « test.my-domain.fr »
http:
paths:
path: /
pathType: Prefix
backend:
service:
name: test-ingress-app1
port:
number: 80

==> Access http://test.my-domain.fr KO