CKAD Services and Networking 1 — Questions and Answers
Question 1: Which Service type exposes an application externally using a cloud provider's load balancer?
- ClusterIP
- NodePort
- LoadBalancer (Correct answer)
- ExternalName
Correct answer: LoadBalancer
LoadBalancer type provisions an external load balancer from the cloud provider, assigning a public IP that routes traffic to the service.
Question 2: What is the default Service type in Kubernetes?
- NodePort
- LoadBalancer
- ClusterIP (Correct answer)
- ExternalName
Correct answer: ClusterIP
ClusterIP is the default Service type, creating a virtual IP accessible only within the cluster.
Question 3: How does a Service select which pods to route traffic to?
- By pod name
- By label selectors matching pod labels (Correct answer)
- By pod IP address
- By container port number
Correct answer: By label selectors matching pod labels
A Service uses 'selector' field with label key-value pairs to dynamically select all matching pods as its endpoints.
Question 4: Which Service type exposes a pod on each node's IP at a static port?
- ClusterIP
- NodePort (Correct answer)
- LoadBalancer
- ExternalName
Correct answer: NodePort
NodePort allocates a static port (30000-32767) on every node and routes external traffic to the service's ClusterIP.
Question 5: What does a Network Policy 'policyTypes: [Ingress]' with no 'ingress' rules do to the selected pods?
- Allows all ingress traffic
- Blocks all ingress traffic to the selected pods (Correct answer)
- Allows only internal cluster traffic
- Has no effect on traffic
Correct answer: Blocks all ingress traffic to the selected pods
When policyTypes includes Ingress but no ingress rules are defined, all ingress traffic to the selected pods is denied.
Question 6: Which DNS name format allows a pod to reach a ClusterIP Service named 'myservice' in namespace 'prod'?
- myservice.prod
- myservice.prod.svc.cluster.local (Correct answer)
- prod.myservice.cluster
- myservice.cluster.prod.local
Correct answer: myservice.prod.svc.cluster.local
Kubernetes DNS resolves services using the fully qualified format '<service>.<namespace>.svc.cluster.local'.
Which Service type exposes an application externally using a cloud provider's load balancer?