Kubernetes Introduction Bonus Content
30 questions on Kubernetes Introduction.
Question 1: What is a Pod in Kubernetes?
- A. A database clustering engine.
- B. The smallest deployable unit in Kubernetes, representing a single instance of a running process (containing one or more tightly coupled containers). β (correct answer)
- C. A hardware server blade in the control plane.
- D. A configuration mapping for ingress load balancers.
Explanation: Pods encapsulate container runtimes, network IPs, and storage volumes. They represent the execution unit in K8s.
Question 2: In Kubernetes architecture, how does a Deployment differ from a ReplicaSet?
- A. Deployments map internal IPs, while ReplicaSets map external IPs.
- B. A Deployment is a higher-level controller that manages ReplicaSets, enabling declarative updates and rollbacks of Pod versions. β (correct answer)
- C. ReplicaSets are deprecated in K8s 1.20+.
- D. ReplicaSets do not scale Pod instances.
Explanation: Deployments define target states. The Deployment controller creates a ReplicaSet to scale and maintain target Pod versions.
Question 3: What is the difference between ClusterIP, NodePort, and LoadBalancer service types?
- A. ClusterIP is public, NodePort is private, LoadBalancer is hybrid.
- B. ClusterIP exposes the service internally within the cluster, NodePort exposes it on a static port on each Node IP, and LoadBalancer provisions an external cloud load balancer. β (correct answer)
- C. LoadBalancer services are strictly software-only.
- D. ClusterIP is used exclusively for stateful sets.
Explanation: These types define access boundaries. ClusterIP is internal-only. NodePort is external-direct. LoadBalancer leverages cloud providers.
Question 4: How does Kubernetes handle sensitive configuration variables like API keys or database passwords?
- A. By storing them in plain text in ConfigMaps.
- B. By using Secrets, which encode data in base64 (and can be encrypted at rest) to prevent hardcoding. β (correct answer)
- C. By forcing developers to write keys directly in Pod code.
- D. By storing configuration values on local host nodes.
Explanation: Secrets store sensitive keys. Note that base64 is encoding, not encryption, so RBAC and encryption-at-rest must still be set up.
Question 5: What is the role of an Ingress Controller in a Kubernetes cluster?
- A. It monitors cluster hardware resources and scales Nodes.
- B. It routes incoming HTTP/HTTPS traffic from outside the cluster to internal Services based on hostnames or URL paths. β (correct answer)
- C. It acts as the master database proxy for SQL servers.
- D. It encrypts internal container storage nodes.
Explanation: Ingress controllers acts as entry gateways (like reverse proxies), processing routing rules defined in Ingress manifests.
Question 6: Which CLI tool is standard for running commands against Kubernetes clusters?
- A. kubeadm
- B. kubectl β (correct answer)
- C. kubelet
- D. minikube
Explanation: kubectl communicates with the API Server to control resources declaratively or imperatively.
Question 7: What does a ConfigMap do?
- A. Stores container image versions.
- B. Stores non-confidential configuration key-value pairs that can be injected into containers as environment variables or volume files. β (correct answer)
- C. Maps network IP addresses of Nodes.
- D. Generates layout templates.
Explanation: ConfigMaps decouple configurations from container images, making apps highly portable.
Question 8: What is the difference between a PersistentVolume (PV) and a PersistentVolumeClaim (PVC)?
- A. PV is in-memory; PVC is on-disk.
- B. PV is the actual storage resource provisioned by administrators, while PVC is a request for storage by a user/Pod. β (correct answer)
- C. PVC is deprecated and replaced by PV.
- D. PV works only on AWS Cloud.
Explanation: PVs represent physical storage assets. PVCs act as vouchers that claim assets for Pods.
Question 9: What is a Node in Kubernetes?
- A. A code module in Node.js.
- B. A worker machine (either VM or physical server) that runs containerized applications managed by the control plane. β (correct answer)
- C. A database table connection.
- D. A server network port.
Explanation: Nodes host the execution runtimes (Kubelet, container runtime, kube-proxy).
Question 10: What is the purpose of Kubernetes Namespaces?
- A. Organizing class files in Python code.
- B. Virtual clusters within a physical cluster used to partition and isolate resources across teams or environments. β (correct answer)
- C. Resolving URL domains.
- D. Allocating memory quotas.
Explanation: Namespaces prevent name collisions, dividing clusters logically (e.g. dev, staging, prod).
Question 11: In Kubernetes Control Plane, what is the role of 'etcd'?
- A. Routing network traffic to pods.
- B. A highly available, consistent key-value store used to hold all cluster state and configuration data. β (correct answer)
- C. Monitoring container logs.
- D. Compiling docker images.
Explanation: etcd is the single source of truth for K8s clusters; backing it up is critical.
Question 12: What does a Pod's 'Ready' status indicate?
- A. The code has compiled successfully.
- B. The containers inside the Pod are running and ready to accept network traffic. β (correct answer)
- C. The image has been pushed to the registry.
- D. The node has booted up.
Explanation: Ready status indicates Pods have passed readiness checks, joining service endpoints.
Question 13: What is the function of the Kubelet?
- A. Routing external HTTP requests to Services.
- B. An agent that runs on each Node in the cluster, ensuring that containers declared in PodSpecs are running and healthy. β (correct answer)
- C. Scheduling Pods to specific Nodes.
- D. Encrypting secret parameters.
Explanation: Kubelet monitors Pod specs from the Control Plane, managing local container runtimes.
Question 14: How does the kube-scheduler select which Node a Pod should run on?
- A. By assigning them randomly.
- B. By evaluating Pod resource requests, taints/tolerations, affinity rules, and matching them against available Node capacities. β (correct answer)
- C. By selecting the Node with the lowest IP address.
- D. By requiring manual admin selection.
Explanation: Filtering and scoring phases determine the optimal Node placement to balance cluster loads.
Question 15: Which K8s resource is best suited to run stateless web app instances with scaling?
- A. StatefulSet
- B. Deployment β (correct answer)
- C. DaemonSet
- D. Job
Explanation: Deployments manage replications and rolling updates of stateless Pod templates.
Question 16: What is the difference between a Liveness Probe and a Readiness Probe?
- A. Liveness is for databases, Readiness is for APIs.
- B. Liveness probes check if a container needs to be restarted; Readiness probes check if a container is ready to accept requests. β (correct answer)
- C. Liveness runs only on startup.
- D. There is no difference.
Explanation: If liveness fails, K8s restarts the container. If readiness fails, K8s stops routing traffic to it.
Question 17: What does a DaemonSet guarantee in a cluster?
- A. That Pods are run only during night hours.
- B. That all (or specific) Nodes run a single copy of a Pod (common for logging agents like Fluentd or monitoring tools). β (correct answer)
- C. That the database runs in-memory.
- D. That ingress controllers bypass firewalls.
Explanation: DaemonSets automatically scale Pods to new Nodes as they join the cluster.
Question 18: Which manifest file format is standard for declaring K8s resources?
- A. JSON
- B. YAML β (correct answer)
- C. XML
- D. TOML
Explanation: YAML represents structured data cleanly, making declarative manifests easy to maintain.
Question 19: What is a StatefulSet best suited for?
- A. Stateless frontends like React.
- B. Stateful applications (like databases) requiring unique, persistent identities, stable network identifiers, and persistent storage. β (correct answer)
- C. Short-lived batch process runs.
- D. Routing public ingress routes.
Explanation: StatefulSets maintain ordinal indexes (pod-0, pod-1), linking stable storage PVs across restarts.
Question 20: How does K8s execute Rolling Updates in Deployments?
- A. By terminating all old Pods before creating new ones.
- B. By gradually replacing old Pod instances with new ones, ensuring zero-downtime service availability. β (correct answer)
- C. By modifying the node operating systems.
- D. By resetting the database connection pool.
Explanation: Rolling updates use maxSurge and maxUnavailable rules to scale new versions while tearing down old ones.
Question 21: What is the function of the API Server (kube-apiserver)?
- A. Running python script files.
- B. The front end of the control plane, exposing the Kubernetes API and processing REST operations. β (correct answer)
- C. Intercepting database queries.
- D. Managing node hardware drivers.
Explanation: All components communicate through the API Server; it validates and configures manifests.
Question 22: What does the 'kube-proxy' do on each Node?
- A. Sniffs network packet payloads.
- B. Manages network rules on host nodes, handling connection forwarding to Pods from Services. β (correct answer)
- C. Authenticates user logins.
- D. Logs container stdout strings.
Explanation: kube-proxy implements IPVS/IPTables rules, translating Service virtual IPs to Pod IPs.
Question 23: What is the security risk of allowing pods to run with hostNetwork=true?
- A. The pod download speed decreases.
- B. It exposes the host's loopback and network interfaces directly to the container, bypassing container network isolation namespaces. β (correct answer)
- C. It prevents the pod from connecting to databases.
- D. It disables pod liveness checks.
Explanation: hostNetwork allows containers to sniff local host interface traffic, raising privilege breakout risks.
Question 24: Which resource executes a short-lived, run-to-completion task?
- A. Deployment
- B. Job (or CronJob) β (correct answer)
- C. Service
- D. StatefulSet
Explanation: Jobs instantiate Pods that exit cleanly upon successful task termination.
Question 25: What does Horizontal Pod Autoscaler (HPA) scale?
- A. The number of Nodes in the cluster.
- B. The number of Pod replicas in a Deployment based on CPU/memory utilization metrics. β (correct answer)
- C. The storage capacity of PVs.
- D. The network bandwidth limit.
Explanation: HPA monitors resource usage alarms, dynamically adjusting replica counts to match load.
Question 26: What is a 'Taint' in Kubernetes Node configurations?
- A. A hardware memory failure code.
- B. An attribute assigned to a Node that repels certain Pods unless they possess a matching 'Toleration' in their spec. β (correct answer)
- C. An administrative access key.
- D. A corrupted container image.
Explanation: Taints and tolerations ensure Pods aren't scheduled onto inappropriate or dedicated worker nodes.
Question 27: What is 'Minikube'?
- A. A small serverless database.
- B. A tool that runs a single-node Kubernetes cluster locally inside a VM, designed for development and testing. β (correct answer)
- C. A lightweight python compiler.
- D. An ingress proxy controller.
Explanation: Minikube lets developers test K8s manifests locally before deploying to cloud networks.
Question 28: What does a Headless Service do in Kubernetes?
- A. It blocks external API access.
- B. A Service defined with clusterIP: None, which returns the direct IP addresses of backend Pods via DNS instead of routing through load-balanced virtual IPs. β (correct answer)
- C. A Service that lacks an Ingress rule.
- D. A Service that runs only on master nodes.
Explanation: Headless services allow direct peer-to-peer connection discovery, crucial for database clusters.
Question 29: What is a Admission Controller in the API Server lifecycle?
- A. A system that bills users for resource usage.
- B. A plugin that intercept requests to the API Server after authentication and authorization but before object storage, mutating or validating manifests. β (correct answer)
- C. A network proxy filter.
- D. A tool that compiles docker images.
Explanation: Admission controllers (e.g. OPA, Kyverno) enforce policies, rejecting invalid configurations.
Question 30: What is the function of the Control Plane?
- A. Styling web pages.
- B. Managing the overall state of the cluster, making global decisions (scheduling), and detecting cluster events. β (correct answer)
- C. Housing database rows.
- D. Executing docker container runs directly.
Explanation: The Control Plane holds core services like the API Server, Scheduler, and Controller Manager.