Courseiva
Services and NetworkinghardMultiple ChoiceObjective-mapped

CKA Services and Networking Practice Question

You have an Ingress resource with the following spec:

spec: rules: - host: example.com http: paths: - path: /api pathType: Prefix backend: service: name: api-service port: number: 80

A client sends a request to http://example.com/api/v1/users. Which path is matched?

⚠ Common exam trap

Many exam-takers confuse `Prefix` with `Exact` and think the entire request path must match the specified path, leading them to incorrectly select Option A or D, or they assume `ImplementationSpecific` is the default behavior when `pathType` is explicitly set.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

/api

The Ingress rule uses `pathType: Prefix` with a path of `/api`. According to the Kubernetes Ingress specification, a Prefix pathType matches any URL path that has the specified path as its prefix. The request `/api/v1/users` starts with `/api`, so it matches the rule, and the traffic is forwarded to the `api-service` on port 80.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • /api/v1/users

    Why it's wrong here

    This is the request URI, not the path defined in the Ingress rule. The rule specifies path /api with pathType Prefix, so any URL that begins with /api—including the full request /api/v1/users—matches. If the pathType were Exact, then /api/v1/users would be the only path that matches that exact string, but that is not the case here.

  • ImplementationSpecific: depends on the Ingress controller

    Why it's wrong here

    pathType is explicitly set to Prefix in the Ingress spec, not ImplementationSpecific. ImplementationSpecific defers path-matching behavior to the Ingress controller (e.g., nginx may use regex), but with Prefix, Kubernetes requires a literal path prefix match that starts at a segment boundary. Therefore, the match is fully determined by the spec and does not depend on the controller's implementation.

  • /api

    Why this is correct

    With pathType Prefix, the path /api matches any request URL whose path starts with /api, and matching is performed on a segment boundary; /api/v1/users begins with /api followed by the / segment, so it satisfies the rule. Prefix is the default and most common pathType for REST APIs because it allows a single rule to govern all nested resource endpoints. Thus /api is the correct path that the Ingress rule defines.

  • No match, returns 404

    Why it's wrong here

    A 404 would only be returned if no Ingress rule matches the request, but this Prefix rule does match /api/v1/users. Because the request path satisfies the /api prefix, the Ingress controller routes the request to the specified backend service, so no 404 is generated by the Ingress layer. A 404 could still be returned later by the backend application, but not as a result of path matching failure.

About these practice questions

This CKA question is part of Courseiva's 302-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.