Courseiva
Services and NetworkingmediumMultiple ChoiceObjective-mapped

CKA Services and Networking Practice Question

You have a Service named 'my-service' in namespace 'ns1'. Another pod in namespace 'ns2' needs to resolve 'my-service' using DNS. What FQDN should the pod use?

⚠ Common exam trap

The trap here is that candidates often forget to include the namespace in the FQDN for cross-namespace service resolution, assuming that the default search path will find the service, but it only searches the pod's own namespace first and will not resolve a service in a different namespace without the explicit namespace qualifier.

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

my-service.ns1.svc.cluster.local

Kubernetes DNS resolves services using the FQDN format `<service>.<namespace>.svc.cluster.local`. Since the pod in namespace 'ns2' needs to resolve 'my-service' which resides in namespace 'ns1', the FQDN must include the target namespace 'ns1' to perform a cross-namespace DNS lookup. Omitting the namespace would default to the pod's own namespace, which would fail to resolve the service.

Answer analysis

Option-by-option breakdown

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

  • my-service.svc.cluster.local

    Why it's wrong here

    This DNS name is a short-form reference for a service, omitting the namespace. While it would resolve correctly if the querying pod were located within the *same* namespace as `my-service` (i.e., `ns1`), it fails when the pod is in a different namespace. Kubernetes DNS search paths are configured to append the current namespace and then the `svc.cluster.local` suffix, but not to search across all namespaces without explicit specification. Therefore, for cross-namespace communication, the fully qualified domain name (FQDN) is required.

  • my-service.cluster.local

    Why it's wrong here

    This DNS name is incorrect because it omits the crucial `.svc` subdomain component. In Kubernetes, the standard DNS naming convention for services explicitly includes `.svc` to differentiate services from other resource types, such as pods or headless services, within the `cluster.local` domain. Without `.svc`, the DNS query will not match the service's A record, preventing successful resolution and connection to the service's endpoints.

  • my-service.ns1.svc.cluster.local

    Why this is correct

    This is the correct Fully Qualified Domain Name (FQDN) for a Kubernetes service. It adheres to the standard format: `<service-name>.<namespace-name>.svc.<cluster-domain>`. Here, `my-service` is the service name, `ns1` is its namespace, `svc` denotes it as a service, and `cluster.local` is the default cluster domain. This FQDN provides an unambiguous and universally resolvable address for the service from any pod within the cluster, regardless of the querying pod's own namespace.

  • my-service.ns2.svc.cluster.local

    Why it's wrong here

    This DNS name is incorrect because it specifies `ns2` as the service's namespace, whereas the question states the service `my-service` resides in `ns1`. While the format is otherwise correct for an FQDN, using the wrong namespace will cause the DNS query to attempt to resolve a service that does not exist at that specific location. Consequently, the DNS lookup will fail, resulting in a "Host not found" error, as the service `my-service` is not registered under `ns2`.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

Courseiva writes every CKA question from scratch — 302 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.