Environment Overview
Begin by reviewing your cluster environment. Verify the nodes, namespaces, deployments, and pods. In this setup, there is one node with various namespaces hosting different components. For instance, run the following command to list all pods across all namespaces:Ingress Controller Details
To verify the Ingress Controller deployment, execute the command below:ingress-nginx-controller and operates within the ingress-nginx namespace.
Application and Ingress Resource
Applications are deployed within the app-space namespace. In our scenario, three application pods are running:- A default backend
- A web application for video streaming
- A web application for wear services
- Two paths:
•/wearroutes towear-serviceon port 8080.
•/watchroutes tovideo-serviceon port 8080. - A default backend (
default-http-backend) is configured to handle unmatched requests. - The host is set to
*, meaning the rules apply across all hosts.
- Accessing
.../wearopens the wear application. - Accessing
.../watch(which will later be changed to.../stream) serves the video streaming application.
Updating the Ingress Resource
Redirecting Video Streaming to “/stream”
To expose the video streaming application under the new URL path/stream:
- Edit the Ingress resource for the app-space namespace.
- Change the path from
/watchto/stream.
- Navigating to
/watchnow results in a 404 error. - Accessing
/streamcorrectly displays the video streaming application.
After updating the Ingress resource, always verify the configuration using:
k get ingress -Ak describe ingress ingress-wear-watch -n app-spaceThis ensures the new path registrations are active.
Adding a Path for the Food Delivery Application
The business has expanded by incorporating a food delivery service, now deployed in the app-space namespace. First, verify the deployments:/eat path. For example:
- Accessing
.../eatdisplays the food delivery application. - All paths will be correctly routed to their respective services.
Integrating a New Payment Service in a Separate Namespace
A new critical payment service is deployed in its own namespace, critical-space. To verify the payment pods, run:/pay path. Use the imperative command:
- The rule routes
/paytopay-serviceon port 8282. - A default backend is present.
By default, the Ingress does not modify the URL path. If the payment application expects requests at
/ rather than /pay, add a rewrite annotation./pay will be rewritten to / before reaching the payment service, ensuring proper application functionality.
Conclusion
This lab demonstrated how to configure and update an Ingress Controller across multiple namespaces and applications. We:- Examined the cluster environment.
- Verified and detailed the Ingress Controller deployment.
- Updated the Ingress resource to change a URL path.
- Added a new path for a food delivery application.
- Created a separate Ingress for a critical payment service with proper path rewrite.