Replicating Kubernetes Ingress locally using Nginx
Sample Application:
- my-bank-nginx-proxy
- runs on port 80
- nginx app having html page - `index.yaml`
- has 2 links: one pointing to customer app (8080) and other to employee app (8081)
- Link to customer and employee apps is via relative path and url is not mentioned in index.html as nginx can handle it
- my-bank-customer - runs on port 8080
- my-bank-employee - runs on port 8081
Steps to run :
- replace <PATH_TO_REPO_ON_LOCAL> in my-bank/docker-compose.yaml
- run docker-compose.yaml using
docker-compose up
- once up, access app at http://localhost:80 (app can also be accessed at my-bank.com if it is added in /etc/hosts)
- upon clicking on
customer portal
, app gets redirected to port 8080 via nginx proxy we created - upon clicking on
employee portal
, app gets redirected to port 8081 via nginx proxy we created
More details here .