Courseiva
Services and Networking →mediumMultiple Choice

CKA Services and Networking Practice Question

Which Ingress resource field is used to specify the hostname for which traffic should be routed?

⚠ Common exam trap

It's easy for candidates to confuse `spec.tls[].hosts` with the routing hostname, thinking TLS host fields also control traffic routing, when in fact they only associate TLS certificates with hostnames and do not affect request routing.

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

✓

spec.rules[].host

In Kubernetes Ingress resources, host-based routing is defined under `spec.rules[].host`. Each rule can specify a hostname, and the Ingress controller uses this field to match the `Host` header of incoming HTTP requests, directing traffic to the appropriate backend service. This is the standard field for routing traffic based on hostname as defined in the Kubernetes Ingress API.

Answer analysis

Option-by-option breakdown

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

  • ✗

    spec.tls[].hosts

    Why it's wrong here

    While the spec.tls[].hosts field does contain hostnames, its purpose is strictly to associate TLS certificates with specific domains for HTTPS termination. It does not define the actual HTTP routing rules or map traffic to backend services, which is handled by the rules block.

  • ✗

    spec.defaultBackend

    Why it's wrong here

    The spec.defaultBackend field defines a catch-all service to handle requests that do not match any of the specified routing rules. Because it acts as a global fallback mechanism, it does not accept or evaluate hostname configurations to route traffic.

  • ✗

    spec.host

    Why it's wrong here

    There is no direct spec.host field defined in the Kubernetes Ingress API schema. Attempting to place a host field directly under the spec root will result in a validation error when applying the manifest, as hostnames must reside within individual rule definitions.

  • ✓

    spec.rules[].host

    Why this is correct

    In an Ingress resource, the spec.rules[].host field is the correct location to specify the domain name for routing. The Ingress controller inspects the HTTP Host header of incoming requests and matches it against this field to apply the corresponding path-based routing rules.

About these practice questions

One of 726 original CKA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.