Bird
0
0

Given this Ingress snippet, which service will receive traffic for URL path '/shop/cart'?

medium📝 Command Output Q13 of 15
Kubernetes - Ingress
Given this Ingress snippet, which service will receive traffic for URL path '/shop/cart'?
rules:
- http:
    paths:
    - path: /shop
      pathType: Prefix
      backend:
        service:
          name: shop-service
          port:
            number: 80
    - path: /blog
      pathType: Prefix
      backend:
        service:
          name: blog-service
          port:
            number: 80
Ablog-service
Bshop-service
Cdefault backend
DNo service matches
Step-by-Step Solution
Solution:
  1. Step 1: Check path matching rules

    Path '/shop/cart' starts with '/shop', matching the first path rule with pathType Prefix.
  2. Step 2: Identify backend service

    The matching path routes to 'shop-service' on port 80.
  3. Final Answer:

    shop-service -> Option B
  4. Quick Check:

    Prefix match '/shop' routes to shop-service [OK]
Quick Trick: Prefix path matches any URL starting with it [OK]
Common Mistakes:
  • Choosing blog-service for /shop/cart
  • Assuming no match for subpaths
  • Confusing default backend with path rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes