Skip to content

KCSA · Domain 2: Kubernetes Cluster Component Security · 22% of the exam

Task 2.9: Container Networking

The Kubernetes network model and CNI plugins, flat Pod networking by default, and where network policy enforcement comes from.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

A node-level monitoring agent runs with hostNetwork: true and must keep it. To let it scrape a database on port 9187, the team adds an ingress rule to the database's NetworkPolicy with a podSelector that matches the agent's labels, yet the scrapes are still dropped. The network plugin uses the most common implementation for such Pods. What does the NetworkPolicy documentation point to?

  1. AAdd a namespaceSelector that matches the agent's namespace to the same from entry
  2. BAllow the nodes' IP addresses with an ipBlock rule instead of the podSelector
  3. CGrant the agent's service account get on the database Service through RBAC
  4. DAdd Egress to the database policy's policyTypes next to Ingress
Show the answer and why
  • AAdd a namespaceSelector that matches the agent's namespace to the same from entry

    Incorrect

    In the common implementation hostNetwork Pods are ignored by namespace selectors as well as pod selectors, so another selector does not match them.

  • BAllow the nodes' IP addresses with an ipBlock rule instead of the podSelector

    Correct

    Most plugins cannot tell hostNetwork Pod traffic apart and ignore those Pods in selectors; their connections look like node traffic, which an ipBlock rule can allow.

  • CGrant the agent's service account get on the database Service through RBAC

    Incorrect

    RBAC authorizes API requests; it has no effect on which network connections a NetworkPolicy allows.

  • DAdd Egress to the database policy's policyTypes next to Ingress

    Incorrect

    That would also restrict the database's outgoing traffic; it does not change how the incoming scrape from a hostNetwork Pod is matched.

NetworkPolicy behavior for hostNetwork Pods is undefined, and the most common implementation ignores them when matching podSelector and namespaceSelector. Because they share their node's IP address, their traffic is treated as node traffic, and the documentation suggests allowing it with an ipBlock rule.

Question 2 · choose 1

An auditor reviews the kube-proxy settings of a cluster and finds that no kube-proxy runs on any node, yet Services work normally. According to the Kubernetes networking overview, what explains this?

  1. AThe API server forwards all Service traffic itself when kube-proxy is absent
  2. BThe kubelet takes over kube-proxy's job automatically on every node
  3. CServices fall back to DNS answers with the Pod IPs, so no proxy is needed
  4. DThe pod network implementation provides its own service proxy in place of kube-proxy
Show the answer and why
  • AThe API server forwards all Service traffic itself when kube-proxy is absent

    Incorrect

    Service traffic is routed by a service proxy implementation that programs the data plane on the nodes, not by the API server.

  • BThe kubelet takes over kube-proxy's job automatically on every node

    Incorrect

    The overview names kube-proxy as the default service proxy and some pod network implementations as the alternative; the kubelet is not one.

  • CServices fall back to DNS answers with the Pod IPs, so no proxy is needed

    Incorrect

    Services provide a stable IP whose traffic a service proxy routes to the backends; there is no fallback that removes the proxy.

  • DThe pod network implementation provides its own service proxy in place of kube-proxy

    Correct

    The overview says kube-proxy is Kubernetes' default service proxy, but some pod network implementations use their own, more tightly integrated service proxy instead.

Kubernetes defines the Service API, and a service proxy implementation watches Services and EndpointSlices and programs the data plane. kube-proxy is the default implementation, but some pod network implementations replace it, so a security review of Service routing has to look at that implementation instead.

Question 3 · choose 1

Which component assigns IP addresses to Pods in a Kubernetes cluster?

  1. Akube-apiserver
  2. Bkube-proxy
  3. CThe kube-scheduler
  4. DThe network plugin
Show the answer and why
  • Akube-apiserver

    Incorrect

    The API server assigns IP addresses to Services, not to Pods.

  • Bkube-proxy

    Incorrect

    kube-proxy implements Service routing; it does not assign Pod addresses.

  • CThe kube-scheduler

    Incorrect

    The scheduler chooses a node for each Pod; it does not assign addresses.

  • DThe network plugin

    Correct

    The cluster networking page says the network plugin is configured to assign IP addresses to Pods.

Kubernetes needs non-overlapping ranges for Pods, Services and Nodes: the network plugin assigns Pod IPs, kube-apiserver assigns Service IPs, and the kubelet or cloud-controller-manager assigns node addresses.

Practice domain 2 →Practice all domains →