Kubernetes MCQs – Networking and Service Discovery

Kubernetes networking is essential for enabling communication between containers, pods, and external services. It includes concepts like ClusterIP, NodePort, LoadBalancer, DNS-based service discovery, and network policies.

This post provides a structured set of multiple-choice questions (MCQs) that help to validate key concepts and commands related to Kubernetes networking and service discovery. These MCQs are particularly helpful for interview preparation and real-world troubleshooting in cloud-native environments.

1.) What is the default type of service in Kubernetes?

A) LoadBalancer
B) NodePort
C) ClusterIP
D) ExternalName

Answer: Option C

Explanation: ClusterIP is the default Service type, which makes the service accessible only within the cluster.

2.) Which service type is used to expose a service on each Node’s IP at a static port?

A) ClusterIP
B) NodePort
C) LoadBalancer
D) Headless

Answer: Option B

Explanation: NodePort exposes the service on a port on each node in the cluster.

3.) What is the function of a kube-proxy in Kubernetes networking?

A) Maintains network rules on nodes
B) Manages DNS entries
C) Manages container logs
D) Schedules pods

Answer: Option A

Explanation: kube-proxy handles network routing and load-balancing for services on each node.

4.) What is the role of CoreDNS in Kubernetes?

A) Provides authentication
B) Handles pod autoscaling
C) Offers service discovery through DNS
D) Manages ingress rules

Answer: Option C

Explanation: CoreDNS translates service names to IP addresses for internal service discovery.

5.) What is the default DNS suffix for services in Kubernetes?

A) .svc.kube.local
B) .svc.cluster.local
C) .kube.svc.local
D) .cluster.svc.local

Answer: Option B

Explanation: Kubernetes services are accessible by default using the .svc.cluster.local DNS domain.

6.) Which service type provisions an external load balancer from the cloud provider

A) LoadBalancer
B) NodePort
C) ClusterIP
D) ExternalName

Answer: Option A

Explanation: LoadBalancer type services request an external load balancer from the cloud provider.

7.) Which of the following allows internal pod-to-pod communication?

A) Network Policy
B) ClusterIP
C) Calico
D) CNI Plugins

Answer: Option D

Explanation: CNI (Container Network Interface) plugins enable networking for pods across nodes.

8.) What command would you use to inspect all services running in the default namespace?

A) kubectl get services –all-namespaces
B) kubectl get svc
C) optkubectl describe serviceion3
D) kubectl list services

Answer: Option B

Explanation: The short form svc is used to list all services in the current namespace.

9.) How do you describe a service named my-service in Kubernetes?

A) kubectl view service my-service
B) kubectl get service my-service
C) kubectl show service my-service
D) kubectl describe service my-service

Answer: Option D

Explanation: This command provides detailed information including endpoints, selectors, and ports.

10.) Which command shows all endpoints associated with services?

A) kubectl get endpoints
B) kubectl get svc-endpoints
C) kubectl describe pods
D) kubectl show services

Answer: Option A

Explanation: This shows IPs and ports of pods associated with each service.

Leave a Reply

Your email address will not be published. Required fields are marked *