Bird
0
0

Given this Ingress rule snippet, what service will receive traffic for host 'app.example.com'?

medium📝 Command Output Q13 of 15
Kubernetes - Ingress
Given this Ingress rule snippet, what service will receive traffic for host 'app.example.com'?
spec:
  rules:
  - host: app.example.com
    http:
      paths:
      - path: /app
        pathType: Prefix
        backend:
          service:
            name: app-service
            port:
              number: 8080
      - path: /
        pathType: Prefix
        backend:
          service:
            name: default-service
            port:
              number: 80
ATraffic to app.example.com with path starting /app goes to app-service; others go to default-service.
BTraffic to app.example.com is rejected because of duplicate host rules.
CTraffic to app.example.com goes only to default-service on port 80.
DAll traffic to app.example.com goes to app-service on port 8080.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the Ingress rules for host 'app.example.com'

    The rule for host 'app.example.com' has two paths: '/app' and '/'.
  2. Step 2: Understand path matching priority

    Requests with path starting '/app' go to 'app-service' on port 8080; all other paths go to 'default-service' on port 80.
  3. Final Answer:

    Traffic to app.example.com with path starting /app goes to app-service; others go to default-service. -> Option A
  4. Quick Check:

    Host + path routing = Traffic to app.example.com with path starting /app goes to app-service; others go to default-service. [OK]
Quick Trick: Check host and path rules separately to find matching service [OK]
Common Mistakes:
  • Assuming all traffic goes to first service listed
  • Thinking duplicate hosts cause rejection
  • Ignoring path prefixes in routing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes