Kubernetes Practice Test ā Questions and Answers
Question 1: In Kubernetes, which of the following key value stores is used as the backup store for all cluster data?
- kube-scheduler
- kubeāapiserve
- kube-controllerāmanager
- etcd (Correct answer)
Correct answer: etcd
In Kubernetes, etcd is the distributed key-value store that serves as the primary backend for all cluster data. It stores the entire configuration, state, and metadata of the Kubernetes cluster, making it a critical component for maintaining the cluster's desired state and ensuring high availability.
Question 2: In Kubernetes, which of the following watches for newly formed pods with no node assigned and selects a node for them to run on?
- kube-scheduler (Correct answer)
- kube-apiserver
- kube-controllerāmanager
- etcd
Correct answer: kube-scheduler
The kube-scheduler is a crucial control plane component in Kubernetes responsible for assigning newly created Pods to appropriate nodes. It continuously watches for Pods that have no node assigned and selects the best node for them to run on, considering factors like resource requirements, hardware constraints, and policy constraints.
Question 3: In Kubernetes, for example, which components make global decisions about the cluster?
- Node components
- Master components (Correct answer)
- Addons components
- Extra components
Correct answer: Master components
Master components, also known as Control Plane components, are the core parts of Kubernetes that make global decisions about the cluster. These components, including the API server, scheduler, controller manager, and etcd, manage the cluster's state, schedule workloads, and respond to cluster events, ensuring the desired state is maintained.
Question 4: In Kubernetes, which phase of the Pod refers to the Pod being bound to a node and all of the Containers being created?
- Pending
- Succeeded
- Bound
- Running (Correct answer)
Correct answer: Running
The 'Running' phase in Kubernetes indicates that a Pod has been successfully bound to a node, and all of its containers have been created. In this phase, at least one container is running, or is in the process of starting or restarting, signifying that the application within the Pod is active on a worker node.
Question 5: In Kubernetes, which of the following runs controllers?
- etcd
- kube-apiserver
- kube-controller-manager (Correct answer)
- kube-scheduler
Correct answer: kube-controller-manager
The kube-controller-manager is a control plane component that runs various controller processes. These controllers continuously monitor the shared state of the cluster through the API server and make changes to move the current state towards the desired state, managing resources like nodes, replication controllers, and endpoints.
Question 6: In Kubernetes, which of the following is an agent that runs on each node in the cluster?
- etcd
- kube-scheduler
- kube-controller-manager
- None of the above (Correct answer)
Correct answer: None of the above
The kubelet is the primary agent that runs on each node in a Kubernetes cluster, ensuring that containers are running in a Pod. Options A, B, and C (etcd, kube-scheduler, kube-controller-manager) are all control plane components that typically run on master nodes, not worker nodes as agents. Therefore, 'None of the above' is the correct choice as kubelet is not listed.
Question 7: In Kubernetes, what does a Label mean?
- A way to expose traffic
- A type of Deployment
- A way to group related things using key/value pairs (Correct answer)
- None of the above
Correct answer: A way to group related things using key/value pairs
In Kubernetes, Labels are key/value pairs attached to objects like Pods, Services, or Nodes. They are used to organize and select subsets of objects, providing a flexible and powerful way to group related resources. Labels enable users to query and operate on groups of objects without requiring strict hierarchical relationships.
Question 8: In Kubernetes, which node condition with the value True indicates that the node is healthy and ready to accept pods?
- ready (Correct answer)
- 0k
- well
- start
Correct answer: ready
The 'Ready' condition for a Kubernetes node, when its value is 'True', signifies that the node is healthy and configured correctly to accept new Pods. This indicates that the kubelet is functioning, the node has sufficient resources, and it can communicate with the Kubernetes control plane.
Question 9: What is at least included in a Kubernetes cluster?
- one master node
- Depends upon configuration
- one worker node
- one worker node and one master node (Correct answer)
Correct answer: one worker node and one master node
A functional Kubernetes cluster, at a minimum, requires at least one master node (or control plane node) to manage the cluster's state and operations, and at least one worker node to run the actual application workloads (Pods). This setup allows for basic scheduling and execution of containerized applications.
Question 10: In Kubernetes, which of the following is the front end for the Kubernetes control plane?
- etcd
- kube-controller-manager
- kube-apiserver (Correct answer)
- kube-scheduler
Correct answer: kube-apiserver
The kube-apiserver acts as the front end for the Kubernetes control plane, exposing the Kubernetes API. It is the central hub for all communication within the cluster, handling requests from users, external components, and other control plane components, and validating and configuring data for API objects.
Question 11: In Kubernetes, fractional requests are used to allocate CPU resources are
- Depends upon resources
- allowed (Correct answer)
- Depends upon implementation
- not allowed
Correct answer: allowed
Kubernetes allows for fractional requests when allocating CPU resources to Pods. This means you can specify CPU requests and limits in units like '0.5' (half a CPU core) or '100m' (100 millicores), enabling fine-grained resource management and efficient utilization of node capacity.
Question 12: To update API objects in place, which kubectl command is used?
- kubectl update
- kubectl version
- kubectl patch (Correct answer)
- None of the above
Correct answer: kubectl patch
The `kubectl patch` command is used to update specific fields of an existing Kubernetes API object in place. Unlike `kubectl apply` or `kubectl replace`, `patch` allows for partial updates, which is useful for modifying only certain attributes of a resource without replacing the entire object definition.
Question 13: Limits and requests for memory in Kubernetes are expressed in
- MB
- bytes (Correct answer)
- GB
- KB
Correct answer: bytes
In Kubernetes, memory limits and requests for containers are fundamentally expressed in bytes. While common suffixes like `Mi` (mebibytes) or `Gi` (gibibytes) are often used for convenience in YAML configurations, these are internally converted to their byte equivalents for resource allocation and management.
Question 14: Which logging agents are included in the Kubernetes distribution?
- Both Stackdriver Logging for use with Google Cloud Platform and Elasticsearch (Correct answer)
- Stackdriver Logging for use with Google Cloud Platform
- Elasticsearch
- None of the above
Correct answer: Both Stackdriver Logging for use with Google Cloud Platform and Elasticsearch
Kubernetes distributions often integrate with or support popular logging agents for collecting and managing container logs. This includes both Stackdriver Logging, commonly used with Google Cloud Platform, and Elasticsearch, a widely adopted open-source solution for log aggregation and analysis.
Question 15: Choose a node component that doesn't manage containers that aren't Kubernetes-created.
- Container runtime
- kubelet (Correct answer)
- kube-proxy
- None of the above
Correct answer: kubelet
The kubelet is the agent that runs on each node and is responsible for managing Pods and their containers, specifically those created by Kubernetes. It does not manage containers that are not part of a Kubernetes Pod; that responsibility falls to the underlying container runtime (e.g., Docker, containerd) directly.
Question 16: Which of the following tools is capable of inspecting and managing Kubernetes cluster resources?
- kubeāproxy
- Container runtime
- kubectl (Correct answer)
- None of the above
Correct answer: kubectl
kubectl is the command-line tool for interacting with Kubernetes clusters. It allows users to run commands against clusters, deploy applications, inspect and manage cluster resources, and view logs, making it the primary interface for cluster administration and development.
Question 17: Choose the Kubernetes controller that is in charge of ensuring that every replication controller object in the system has the correct amount of pods.
- Replication controller (Correct answer)
- Service Account & Token controllers
- Node controller
- Endpoints controller
Correct answer: Replication controller
The Replication Controller (or its successor, ReplicaSet) is a Kubernetes controller responsible for ensuring that a specified number of identical Pod replicas are running at all times. It monitors the desired state and automatically creates or deletes Pods to match the configured replica count, maintaining application availability.
Question 18: If you're using kubectl to create a Kubernetes object, choose the field in the.yaml file that contains data that helps to uniquely identify the object, such as a name string, UID, and optional namespace.
- kind
- apiVersion
- spec
- metada (Correct answer)
Correct answer: metada
In a Kubernetes `.yaml` file, the `metadata` field contains data that uniquely identifies the object and helps with its management. This includes essential information such as the object's `name`, a unique `UID`, and its `namespace`, along with optional `labels` and `annotations`.
Question 19: What is a tool that hosts a single-node Kubernetes cluster on your personal computer as a virtual machine?
- kube-proxy
- Minikube (Correct answer)
- Container runtime
- kubectl
Correct answer: Minikube
Minikube is a popular tool designed to run a single-node Kubernetes cluster on a local machine, typically within a virtual machine. It provides a convenient way for developers to test applications and experiment with Kubernetes features without needing a full-fledged multi-node cluster.
Question 20: If an operating system packet filtering layer exists and is available, select the Kubernetes node component that uses it.
- Container runtime
- kubelet
- kube-proxy (Correct answer)
- None of the above
Correct answer: kube-proxy
The kube-proxy is a network proxy that runs on each node in a Kubernetes cluster. It is responsible for implementing the Kubernetes Service concept by maintaining network rules on the node. It uses the operating system's packet filtering layer, such as `iptables` or `IPVS`, to forward traffic to the correct Pods behind a Service.
Question 21: What is the Kubernetes control plane's front end?
- etcd
- kubeāscheduler
- kube-controller-manager
- kube-apiserver (Correct answer)
Correct answer: kube-apiserver
The kube-apiserver serves as the front end for the Kubernetes control plane. It exposes the Kubernetes API, which is the central interface through which all internal and external components communicate with the cluster, enabling management and orchestration of resources.
Question 22: If you're using kubectl to create a Kubernetes object, select the field in the.yaml file that stores the version of the Kubernetes API you're using.
- kind
- Spec
- apiVersion (Correct answer)
- metadata
Correct answer: apiVersion
In a Kubernetes `.yaml` file, the `apiVersion` field specifies the version of the Kubernetes API that the object being created or modified conforms to. This field is crucial for ensuring compatibility and correct interpretation of the object's definition by the Kubernetes API server.
Question 23: The contents of a Kubernetes Pod always run in
- Depends upon resources
- shared context (Correct answer)
- Depends upon implementation
- exclusive context
Correct answer: shared context
A Kubernetes Pod is the smallest deployable unit and represents a single instance of a running process. All containers within a single Pod share the same network namespace, IP address, and storage volumes. This means they operate in a shared context, allowing them to communicate with each other via `localhost` and share data efficiently.
Question 24: When a Kubernetes Container is created, it has access to a list of all services that were operating as
- configuration file
- global accessible file
- environment variable (Correct answer)
- None of the above
Correct answer: environment variable
When a Kubernetes Container is created, it gains access to information about other services in the cluster through environment variables. Kubernetes automatically injects these variables, providing details like the service's IP address and port. This mechanism allows containers to discover and connect to other services without needing hardcoded network locations.
Question 25: Which Kubernetes controller is in charge of noticing and responding to nodes going down?
- Replication controller
- Node controller (Correct answer)
- Service Account & Token controllers
- Endpoints controller
Correct answer: Node controller
The Node controller is a crucial component of the Kubernetes control plane responsible for managing Node objects. Its primary function is to continuously monitor the health and availability of all nodes in the cluster. When a node becomes unresponsive or goes down, the Node controller detects this change and updates its status, triggering necessary actions like rescheduling Pods.
In Kubernetes, which of the following key value stores is used as the backup store for all cluster data?