Explore key Kubernetes networking concepts with this quiz designed to assess your foundational knowledge of service types, pod communication, network policies, and in-cluster DNS. Perfect for beginners in cloud native or DevOps environments seeking to strengthen their understanding of Kubernetes networking fundamentals.
Which Kubernetes service type enables network access to a group of pods only within the cluster without exposing them externally?
Explanation: ClusterIP is the default service type in Kubernetes, providing internal access to pods without external exposure. NodeIP is not a valid Kubernetes service type, while LoadBalancer and Ingress are used to allow traffic from outside the cluster. Only ClusterIP restricts access to inside the cluster network, making it the correct answer.
In a default Kubernetes cluster setup, how can two pods running on different nodes communicate with each other?
Explanation: Pods in a standard Kubernetes cluster can communicate directly using their IPs because the network is flat and routable across all nodes. Communication does not require a LoadBalancer service. Modifying host firewall settings or using a public DNS is unnecessary for basic pod-to-pod networking, making those options incorrect.
What is the purpose of a NetworkPolicy resource in Kubernetes networking?
Explanation: NetworkPolicy resources are used to define rules that control how pods are allowed to communicate with each other and with network endpoints. They do not monitor cluster usage, manage storage, or handle version upgrades. The distractor options cover areas unrelated to networking control.
What DNS name format allows a pod to reach a Kubernetes service called 'webapp' in the 'frontend' namespace?
Explanation: Kubernetes assigns service DNS names in the format service-name.namespace.svc.cluster.local, allowing pods to use these to find services across namespaces. The other options present incorrect formats that do not align with Kubernetes DNS conventions and would not resolve properly.
When using the NodePort service type, through what mechanism can users access applications from outside the Kubernetes cluster?
Explanation: With NodePort, users can access services externally by sending requests to the cluster’s node IPs on a designated port. Internal pod IPs and cluster DNS addresses are inaccessible from outside the cluster, and direct API server communication is not used for ordinary application requests. Therefore, the other options do not facilitate external access via NodePort.