Kubernetes MCQs – Networking and Service Discovery

11.) What is the default port for the Kubernetes API server?

A) 443
B) 8080
C) 6443
D) 3000

Answer: Option C

Explanation: Port 6443 is the default secure port used by the Kubernetes API server.

12.) What happens if a service has no selectors defined?

A) It fails to start
B) It points to no pods
C) It randomly selects pods
D) It throws an error

Answer: Option B

Explanation: Without selectors, the service does not associate with any endpoints (pods).

13.) What is used to restrict network traffic between pods?

A) Ingress
B) Egress
C) NetworkPolicy
D) NodePort

Answer: Option C

Explanation: NetworkPolicy allows you to control traffic flow between pods.

14.) Which of the following is NOT a valid service type in Kubernetes?

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

Answer: Option C

Explanation: TunnelPort is not a valid Kubernetes service type.

15.) How do you expose a deployment via a NodePort service?

A) kubectl expose deployment myapp –type=NodePort –port=80
B) kubectl expose deployment myapp –type=NodePort –port=80
C) kubectl open port myapp –port=80
D) kubectl publish myapp –type=nodeport

Answer: Option A

Explanation: This command exposes a deployment through a NodePort.

16.) What plugin does Kubernetes use for DNS resolution?

A) etcd
B) kube-proxy
C) CoreDNS
D) Nginx

Answer: Option C

Explanation: CoreDNS is the DNS server used by Kubernetes for internal name resolution.

17.) Which service type allows a DNS alias to redirect to an external name (like google.com)?

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

Answer: Option A

Explanation: ExternalName maps a Kubernetes service to an external hostname.

18.) How do you display all services in all namespaces?

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

Answer: Option D

Explanation: This command shows all services running in every namespace.

19.) What flag would you use to assign a static port when exposing a service via NodePort?

A) –port
B) –node-port
C) –external-port
D) –static-port

Answer: Option B

Explanation: Use –node-port to specify a static port in the 30000-32767 range.

20.) Which CNI plugin supports advanced networking features like network policies and IP pools?

A) Flannel
B) Weave
C) Calico
D) Bridge

Answer: Option C

Explanation: Calico supports complex network policies and IP control.

Leave a Reply

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