KCNA · Domain 2: Container Orchestration · 28% of the exam
Task 2.1: Networking
The Kubernetes network model and CNI plugins, Service types and EndpointSlices, cluster DNS, Ingress and the Gateway API, network policies, and where a service mesh fits.
The network model, CNI, cluster DNS, the Gateway API and network policies
Lesson coming
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 team moving from virtual machines expects to configure port mappings or NAT so that a Pod on one node can reach a Pod on another node. What does the Kubernetes network model say about this?
AA Pod can be reached from another node through a hostPort mapped on its node
BEach Pod has its own cluster-wide IP, and Pods reach each other on it directly, without NAT
CPod IP addresses are routable just within the node where the Pod runs, so cross-node traffic needs NAT
DThe kubelet translates addresses between nodes for each Pod-to-Pod connection
Show the answer and why
AA Pod can be reached from another node through a hostPort mapped on its node
Incorrect
hostPort exposes a Pod on its node's address; it is not needed for Pod-to-Pod traffic, which uses Pod IPs.
BEach Pod has its own cluster-wide IP, and Pods reach each other on it directly, without NAT
Correct
The model gives every Pod a unique cluster-wide IP and lets all Pods communicate, on the same or different nodes, without proxies or address translation.
CPod IP addresses are routable just within the node where the Pod runs, so cross-node traffic needs NAT
Incorrect
Pod IPs are cluster-wide. The network plugin makes them reachable from every node.
DThe kubelet translates addresses between nodes for each Pod-to-Pod connection
Incorrect
The kubelet runs Pods; it does not translate traffic. Pod-to-Pod traffic needs no translation at all.
Kubernetes networking is flat: Pods talk to each other on their own IPs across the cluster, and a network plugin implements that model.
A backend API must be reachable by other workloads in the cluster through one stable address, and it must not be reachable from outside the cluster. Which Service type fits?
ANodePort
BLoadBalancer
CExternalName
DClusterIP
Show the answer and why
ANodePort
Incorrect
NodePort opens a port on every node's IP address, which exposes the Service outside the cluster network.
BLoadBalancer
Incorrect
LoadBalancer exposes the Service outside the cluster through an external load balancer, the opposite of what is wanted.
CExternalName
Incorrect
ExternalName maps the Service to an external DNS name with a CNAME record; it does not front Pods in the cluster.
DClusterIP
Correct
ClusterIP, the default type, gives the Service a virtual IP that is reachable only from inside the cluster.
ClusterIP is the internal Service type. NodePort and LoadBalancer add ways in from outside, and ExternalName points at something outside.
A Pod in the namespace shop must call the Service orders, which lives in the namespace billing. The cluster uses the default cluster.local domain. Which DNS name should the Pod use?
Aorders.billing.svc.cluster.local
Borders
Cbilling.orders.svc.cluster.local
Dorders.billing.pod.cluster.local
Show the answer and why
Aorders.billing.svc.cluster.local
Correct
Service records follow <service>.<namespace>.svc.<cluster-domain>, so this name resolves to the Service in billing.
Borders
Incorrect
A bare name is expanded with the client's own namespace first, so from shop it looks for orders.shop.svc.cluster.local.
Cbilling.orders.svc.cluster.local
Incorrect
The order is reversed; the Service name comes before the namespace.
Dorders.billing.pod.cluster.local
Incorrect
Services are published under svc. The pod subdomain is for Pod address records, not Service names.
Cluster DNS gives every Service a name of the form service.namespace.svc.cluster-domain; a short name works only from the same namespace.
A team creates an Ingress with host and path rules that point at a working Service. kubectl get ingress shows no address, and no request ever reaches the Service. What is the most likely cause?
AThe Service has type ClusterIP instead of NodePort
BThe Ingress lives in the same namespace as the Service
CNo Ingress controller is running in the cluster
Dkube-proxy does not support HTTP routing rules
Show the answer and why
AThe Service has type ClusterIP instead of NodePort
Incorrect
Ingress backends are commonly ClusterIP Services; the controller forwards to them inside the cluster.
BThe Ingress lives in the same namespace as the Service
Incorrect
An Ingress refers to backend Services in its own namespace, so that is the expected setup.
CNo Ingress controller is running in the cluster
Correct
An Ingress is only a set of rules. An Ingress controller has to read them and do the routing; creating the resource alone has no effect.
Dkube-proxy does not support HTTP routing rules
Incorrect
Routing by host and path is the Ingress controller's job, not kube-proxy's, so this is not the cause.
Ingress objects need an Ingress controller to fulfill them. Without one, the rules sit in the API and nothing routes traffic.
A team adds a NetworkPolicy meant to select the database Pods and allow ingress only from Pods labeled app=api. After it is applied, other Pods in the namespace can still connect to the database. Which two causes could explain this? (Choose TWO.)
AThe policy needs policyTypes set to Egress to restrict incoming connections
BThe cluster's network plugin does not enforce NetworkPolicy
CThe policy's podSelector does not match the labels on the database Pods
DTraffic between Pods of one namespace is outside the scope of NetworkPolicy
EThe policy acts on traffic sent to a Service's ClusterIP, not on direct Pod IPs
Show the answer and why
AThe policy needs policyTypes set to Egress to restrict incoming connections
Incorrect
Incoming connections are governed by Ingress rules; Egress covers traffic leaving the selected Pods.
BThe cluster's network plugin does not enforce NetworkPolicy
Correct
Policies are enforced by the network plugin. Creating a NetworkPolicy without a plugin that implements it has no effect.
CThe policy's podSelector does not match the labels on the database Pods
Correct
A policy isolates only the Pods it selects. If the selector misses the database Pods, they stay non-isolated and accept all traffic.
DTraffic between Pods of one namespace is outside the scope of NetworkPolicy
Incorrect
Policies apply to Pod-to-Pod traffic within a namespace as well as across namespaces.
EThe policy acts on traffic sent to a Service's ClusterIP, not on direct Pod IPs
Incorrect
NetworkPolicy works on Pod IPs and ports at layer 3 and 4; traffic through a Service is treated the same way.
Two things must hold for a policy to bite: a network plugin that enforces NetworkPolicy, and a podSelector that actually selects the Pods to protect.