Configure Ingress Routing with Traefik for a Multi-Service Shop Application
Scenario
A shop application is running in namespace prod with two backend microservices — product-service on port 9000 and cart-service on port 9001.
Traefik is already installed as the Ingress controller.
You need to create an Ingress resource to route traffic to the correct service based on the URL path and configure /etc/hosts so the hostname resolves correctly.
Task
Create an Ingress named shop-ingress in namespace prod. Use traefik as the ingressClassName and set the host to shop.familymart.com.
Route /products to product-service on port 9000, /cart to cart-service on port 9001.
After creating the Ingress, retrieve all Traefik LoadBalancer external IPs and add them to /etc/hosts on your node cplane-01, mapping them to shop.familymart.com so the domain resolves correctly from any node.
curl http://shop.familymart.com/products | jq
curl http://shop.familymart.com/cart | jq
After successfully creating the Ingress, run kubectl radar on cplane-01, open it in your browser on port 9280, and use the three-dot menu (⋮) in the top-right corner to select “Expose HTTP port” (optional).
Hint 1
Use spec.ingressClassName to specify traefik.
Run kubectl get svc traefik -n kube-system to get the LoadBalancer IP and add <IP> shop.familymart.com to /etc/hosts.
See the official docs: Ingress