k8s quiz Quiz

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.

  1. ClusterIP Services Basics

    Which Kubernetes service type enables network access to a group of pods only within the cluster without exposing them externally?

    1. ClusterIP
    2. NodeIP
    3. LoadBalancer
    4. Ingress

    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.

  2. Pod-to-Pod Communication

    In a default Kubernetes cluster setup, how can two pods running on different nodes communicate with each other?

    1. Directly using pod IP addresses
    2. Only through a LoadBalancer service
    3. By modifying host firewall settings
    4. Through a public DNS

    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.

  3. Understanding Network Policies

    What is the purpose of a NetworkPolicy resource in Kubernetes networking?

    1. To restrict traffic between pods based on rules
    2. To monitor cluster resource usage
    3. To allocate persistent storage
    4. To upgrade Kubernetes versions

    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.

  4. Service DNS in Clusters

    What DNS name format allows a pod to reach a Kubernetes service called 'webapp' in the 'frontend' namespace?

    1. webapp.frontend.svc.cluster.local
    2. webapp.namespace.internal
    3. service-webapp.frontend.default
    4. webapp.frontend.pod.cluster

    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.

  5. NodePort Services Usage

    When using the NodePort service type, through what mechanism can users access applications from outside the Kubernetes cluster?

    1. By sending requests to node IPs on a specified port
    2. By using pod-specific internal IP addresses
    3. By accessing the internal cluster DNS
    4. By contacting the API server directly

    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.