Bird
0
0

Given this Ingress snippet, what service will receive traffic for host example.com and path /shop?

medium📝 Command Output Q4 of 15
Kubernetes - Ingress
Given this Ingress snippet, what service will receive traffic for host example.com and path /shop?
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /shop
        pathType: Prefix
        backend:
          service:
            name: shop-service
            port:
              number: 8080
      - path: /blog
        pathType: Prefix
        backend:
          service:
            name: blog-service
            port:
              number: 80
ANo service matches /shop path
Bblog-service on port 80
Cdefault backend service
Dshop-service on port 8080
Step-by-Step Solution
Solution:
  1. Step 1: Identify host and path match

    The host is example.com and path /shop matches the first path rule.
  2. Step 2: Check backend service for /shop

    The backend service for /shop is shop-service on port 8080.
  3. Final Answer:

    shop-service on port 8080 -> Option D
  4. Quick Check:

    Path /shop routes to shop-service:8080 [OK]
Quick Trick: Match host and path to backend service in rules [OK]
Common Mistakes:
  • Confusing /shop with /blog path
  • Ignoring pathType Prefix matching
  • Assuming default backend handles /shop

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes