Kubernetes Container Orchestration Networking Services 5 — Questions and Answers
Question 1: What is the function of CoreDNS in a Kubernetes cluster?
- Manages pod IP address assignment
- Provides cluster-internal DNS resolution for Services and pods (Correct answer)
- Monitors network latency between nodes
- Enforces NetworkPolicy rules
Correct answer: Provides cluster-internal DNS resolution for Services and pods
CoreDNS runs as a Deployment in kube-system and resolves cluster-internal DNS names (e.g., <service>.<namespace>.svc.cluster.local) for pods.
Question 2: What DNS name format does Kubernetes use for Services within the same namespace?
- <service>.cluster.local
- <service>.<namespace>.svc
- <service>
- <service>.<namespace>.svc.cluster.local (Correct answer)
Correct answer: <service>.<namespace>.svc.cluster.local
The fully qualified DNS name for a Service is <service-name>.<namespace>.svc.cluster.local, though within the same namespace a short name also resolves.
Question 3: Which Kubernetes resource replaced Endpoints for improved scalability, especially in large clusters?
- ServiceSlice
- EndpointSlice (Correct answer)
- PodSlice
- NetworkEndpoint
Correct answer: EndpointSlice
EndpointSlice shards endpoint data into smaller chunks (default 100 endpoints per slice), reducing the size of watch events and etcd load compared to monolithic Endpoints objects.
Question 4: What is the purpose of the service.kubernetes.io/topology-aware-hints annotation on a Service?
- Restricts the Service to a specific availability zone
- Hints to kube-proxy to prefer endpoints in the same zone as the client (Correct answer)
- Enables cross-cluster Service discovery
- Forces all traffic through a single node
Correct answer: Hints to kube-proxy to prefer endpoints in the same zone as the client
Topology-aware hints instruct kube-proxy and EndpointSlice controllers to prefer routing traffic to endpoints in the same zone, reducing inter-zone data transfer costs.
Question 5: When a pod's dnsPolicy is set to None, what must the pod spec also provide?
- A hostNetwork: true field
- A dnsConfig section with custom nameservers (Correct answer)
- A clusterDNS annotation
- Nothing; None disables all DNS
Correct answer: A dnsConfig section with custom nameservers
A dnsPolicy of None means the pod ignores cluster DNS entirely, so the pod must supply a dnsConfig block with explicit nameservers and search domains.
Question 6: What does setting hostNetwork: true on a pod do?
- Assigns the pod a LoadBalancer IP
- Makes the pod share the node's network namespace and IP (Correct answer)
- Enables IPv6 for the pod
- Bypasses NetworkPolicy rules
Correct answer: Makes the pod share the node's network namespace and IP
With hostNetwork: true the pod uses the node's network stack directly, meaning it shares the node's IP address and can listen on node ports without a Service.
Question 7: Which Kubernetes feature allows a Service to be discovered across multiple clusters using a shared DNS zone?
- Multi-cluster Services (MCS) (Correct answer)
- Federation v2
- CrossClusterIngress
- ClusterLink
Correct answer: Multi-cluster Services (MCS)
The Multi-Cluster Services API (KEP-1645) defines ServiceExport and ServiceImport resources that enable Services to be discovered and consumed across cluster boundaries.
What is the function of CoreDNS in a Kubernetes cluster?