Linux Foundation KCNA Practice Test Questions and Exam Dumps Part18 Q341-360

View Full Linux Foundation KCNA Exam Dumps and Practice Test Dumps.

 

Question 341

Which Kubernetes object is primarily used to maintain a desired number of identical Pod replicas?

  1. ReplicaSet
  2. ConfigMap
  3. Service
  4. Namespace

Correct Answer: 1

Explanation

A ReplicaSet maintains a specified number of identical Pod replicas. If one of the managed Pods is deleted or becomes unavailable, the ReplicaSet attempts to create another Pod to restore the desired replica count. ReplicaSets use label selectors to determine which Pods they manage. Deployments commonly create and manage ReplicaSets automatically, especially when rolling out new application versions. ConfigMaps store configuration, Services provide network access, and Namespaces provide logical resource separation. ReplicaSets therefore provide the basic replica-maintenance functionality used by Kubernetes workloads.

Question 342

Which Kubernetes workload controller is generally used to manage stateless applications and support rolling updates?

  1. Job
  2. Deployment
  3. DaemonSet
  4. StatefulSet

Correct Answer: 2

Explanation

A Deployment is commonly used to manage stateless applications and provides declarative updates for Pods and ReplicaSets. It can maintain the desired number of replicas and perform rolling updates when the Pod template changes. Deployments can also support rollback to a previous revision when needed. Jobs are designed for tasks that eventually complete, DaemonSets place Pods on eligible nodes, and StatefulSets provide stable identities and storage characteristics for stateful workloads. Deployments are therefore a common choice for web applications, APIs, and other stateless services.

Question 343

Which Kubernetes workload controller is designed to run a Pod on each eligible node?

  1. StatefulSet
  2. Deployment
  3. DaemonSet
  4. Job

Correct Answer: 3

Explanation

A DaemonSet ensures that a copy of a Pod runs on each node that matches its scheduling requirements. This makes DaemonSets useful for node-level workloads such as logging agents, monitoring agents, and networking components. When a new eligible node joins the cluster, the DaemonSet can automatically create the required Pod there. Deployments manage replicated application workloads, StatefulSets provide stable identities for stateful applications, and Jobs manage finite tasks. DaemonSets are therefore especially appropriate for services that need node-level coverage across a cluster.

Question 344

Which Kubernetes workload is intended for a task that should run to completion rather than continuously?

  1. Service
  2. Job
  3. Deployment
  4. ConfigMap

Correct Answer: 2

Explanation

A Job creates one or more Pods and tracks their successful completion. Jobs are appropriate for finite tasks such as database migrations, batch processing, data transformation, or administrative operations. Unlike a Deployment, which normally keeps a desired number of Pods running continuously, a Job is considered successful when its required work completes. A Service provides networking, while a ConfigMap stores configuration information. Jobs can also be configured with parallelism and completion requirements when multiple Pods need to participate in a batch workload.

Question 345

Which Kubernetes workload is designed to create Jobs on a recurring schedule?

  1. CronJob
  2. ReplicaSet
  3. DaemonSet
  4. StatefulSet

Correct Answer: 1

Explanation

A CronJob creates Jobs according to a specified schedule using cron-style scheduling syntax. It is useful for recurring operations such as backups, reports, cleanup tasks, and periodic data processing. Each scheduled execution can create a Job, which then manages the Pods performing the actual work. ReplicaSets maintain Pod replicas, DaemonSets place Pods across eligible nodes, and StatefulSets manage stateful workloads with stable identities. CronJobs therefore provide Kubernetes with a mechanism for automating recurring batch operations.

Question 346

Which Kubernetes workload is most appropriate when Pods require stable network identities and ordered deployment behavior?

  1. Deployment
  2. Job
  3. StatefulSet
  4. DaemonSet

Correct Answer: 3

Explanation

A StatefulSet is designed for applications that require stable identities, predictable Pod naming, and other stateful workload characteristics. StatefulSet Pods receive stable ordinal identities, such as application-0 and application-1. They can also work with persistent storage and controlled startup or termination behavior. Deployments are generally used for stateless workloads, Jobs handle finite tasks, and DaemonSets place workloads on nodes. StatefulSets are commonly associated with databases, clustered applications, and other systems where stable identity or persistent state is important.

Question 347

Which Kubernetes object provides a stable network endpoint for a set of Pods selected by labels?

  1. Service
  2. ConfigMap
  3. ReplicaSet
  4. Secret

Correct Answer: 1

Explanation

A Kubernetes Service provides a stable network endpoint for accessing a group of Pods. It normally uses a label selector to determine which Pods should receive traffic. Because Pod IP addresses can change when Pods are recreated, clients should generally communicate through the Service rather than depending directly on individual Pod addresses. Services can provide different exposure methods, including ClusterIP, NodePort, and LoadBalancer. ConfigMaps and Secrets store configuration data, while ReplicaSets maintain Pod replicas. Services therefore provide stable application networking within Kubernetes.

Question 348

What is the main purpose of a Kubernetes Namespace?

  1. To create a physical cluster node
  2. To provide logical separation of resources
  3. To store container images
  4. To replace etcd

Correct Answer: 2

Explanation

A Namespace provides logical separation for many Kubernetes resources within a cluster. It can help organize workloads, teams, environments, and applications. Namespaces can also be used with RBAC, ResourceQuotas, and other policies to control access and resource consumption. They do not create physical nodes or replace cluster components such as etcd. Namespaces are primarily an organizational and administrative mechanism. Using separate Namespaces can make large clusters easier to manage by grouping related resources and applying appropriate policies to each logical environment.

Question 349

Which Kubernetes resource can limit the total amount of CPU and memory that workloads in a Namespace may consume?

  1. ResourceQuota
  2. Service
  3. ConfigMap
  4. Ingress

Correct Answer: 1

Explanation

ResourceQuota can limit aggregate resource consumption within a Namespace. Administrators can use quotas to restrict the total amount of CPU, memory, object counts, and other supported resources that workloads can consume. This helps prevent one Namespace or team from consuming an excessive share of cluster capacity. ResourceQuota works at the aggregate Namespace level, while LimitRange can define constraints or defaults for individual Pods and containers. Services and Ingress manage networking, and ConfigMaps store configuration. ResourceQuota is therefore an important tool for multi-tenant resource management.

Question 350

Which Kubernetes object can define default resource requests and limits for containers in a Namespace?

  1. NetworkPolicy
  2. LimitRange
  3. ServiceAccount
  4. ClusterRole

Correct Answer: 2

Explanation

A LimitRange can define default, minimum, and maximum resource constraints for individual containers or Pods within a Namespace. For example, administrators can establish default CPU and memory requests so that workloads receive resource settings even when developers do not explicitly specify them. LimitRange can also enforce minimum or maximum resource values. ResourceQuota operates at the aggregate Namespace level rather than defining individual container defaults. NetworkPolicy controls network traffic, ServiceAccounts provide identities, and ClusterRoles define permissions. LimitRange therefore helps standardize resource configuration.

Question 351

Which Kubernetes feature can automatically adjust the number of Pod replicas based on observed resource utilization?

  1. HPA
  2. ConfigMap
  3. PVC
  4. RoleBinding

Correct Answer: 1

Explanation

The Horizontal Pod Autoscaler, or HPA, automatically adjusts the number of replicas in a scalable workload based on observed metrics and configured targets. CPU and memory utilization are common examples, although other metrics can also be used when supported by the cluster’s metrics infrastructure. HPA is different from vertical scaling because it changes the number of Pods rather than the resources assigned to an individual Pod. ConfigMaps store configuration, PVCs request persistent storage, and RoleBindings assign RBAC permissions. HPA is therefore useful for workloads whose demand changes over time.

Question 352

What does the Kubernetes Vertical Pod Autoscaler primarily adjust?

  1. Number of cluster nodes
  2. Service IP addresses
  3. CPU and memory resource requests for Pods
  4. Namespace names

Correct Answer: 3

Explanation

The Vertical Pod Autoscaler, or VPA, primarily adjusts CPU and memory resource requests for Pods based on observed workload behavior and configured policies. This differs from the Horizontal Pod Autoscaler, which changes the number of Pod replicas. VPA can help workloads receive resource requests that better reflect their actual usage patterns. Its operation and update behavior depend on its configuration and deployment. VPA does not rename Namespaces, modify Service IP addresses, or directly add physical cluster nodes. It focuses on vertical resource sizing for workloads.

Question 353

Which autoscaling component can add or remove cluster nodes when workloads require more or less capacity?

  1. kube-proxy
  2. Cluster Autoscaler
  3. CoreDNS
  4. kubelet

Correct Answer: 2

Explanation

The Cluster Autoscaler adjusts the number of cluster nodes based on workload scheduling requirements and available capacity, when integrated with a supported infrastructure environment. It can add nodes when Pods cannot be scheduled because of insufficient capacity and remove underutilized nodes when appropriate conditions are met. This differs from HPA, which changes the number of application Pods, and VPA, which adjusts Pod resource requests. kube-proxy handles Service networking, CoreDNS provides DNS services, and kubelet manages workloads on individual nodes.

Question 354

Which Kubernetes mechanism is used to prevent a voluntary disruption from taking down too many application replicas at once?

  1. PodDisruptionBudget
  2. ConfigMap
  3. ClusterRole
  4. StorageClass

Correct Answer: 1

Explanation

A PodDisruptionBudget, or PDB, specifies limits on how many replicas of an application can be voluntarily disrupted at the same time. It can help maintain application availability during operations such as node maintenance or cluster administration. A PDB does not prevent every possible failure because involuntary disruptions, such as hardware failure, can still occur. ConfigMaps store configuration, ClusterRoles define RBAC permissions, and StorageClasses describe storage provisioning behavior. PDBs therefore provide an availability safeguard during planned or voluntary disruptions.

Question 355

Which Kubernetes feature allows a container to execute with a specified non-root user identity?

  1. Service
  2. Security context
  3. ResourceQuota
  4. Ingress

Correct Answer: 2

Explanation

A Kubernetes security context allows administrators to specify security-related settings for Pods and containers. One available setting can specify the user identity under which a container should run, helping applications avoid unnecessary root privileges. Security contexts can also control aspects such as group IDs, filesystem behavior, and privilege-related settings. Services and Ingress manage networking, while ResourceQuota controls aggregate resource usage. Using appropriate security context settings can support the principle of least privilege and reduce unnecessary permissions available to application processes.

Question 356

Which container security setting can help ensure that a container does not run as the root user?

  1. runAsNonRoot
  2. hostNetwork
  3. restartPolicy
  4. imagePullPolicy

Correct Answer: 1

Explanation

The runAsNonRoot security setting can be used to require that a container runs with a non-root user identity. This is useful for reducing the privileges available to application processes and improving workload security. Administrators may also specify a particular user ID using runAsUser when appropriate. hostNetwork controls whether a Pod uses the node’s network namespace, restartPolicy controls Pod restart behavior, and imagePullPolicy determines when container images are pulled. runAsNonRoot is therefore specifically related to preventing containers from running as root.

Question 357

Which Kubernetes mechanism can control whether Pods are allowed to communicate with other Pods or external endpoints?

  1. NetworkPolicy
  2. ReplicaSet
  3. StatefulSet
  4. ConfigMap

Correct Answer: 1

Explanation

NetworkPolicy defines rules controlling network communication for selected Pods. Depending on the networking implementation and policy configuration, administrators can restrict ingress traffic, egress traffic, or both. Policies can use selectors and other conditions to define permitted communication paths. ReplicaSets maintain Pod replicas, StatefulSets manage stateful workloads, and ConfigMaps provide configuration data. NetworkPolicy is therefore a key Kubernetes mechanism for implementing network segmentation and reducing unnecessary communication between workloads.

Question 358

Which Kubernetes resource is used to request persistent storage for a workload?

  1. PersistentVolume
  2. PersistentVolumeClaim
  3. StorageClass
  4. ConfigMap

Correct Answer: 2

Explanation

A PersistentVolumeClaim, or PVC, is a request for storage made by a workload or user. It specifies requirements such as storage capacity and access modes. Kubernetes can bind the claim to a suitable PersistentVolume, either one already available or one dynamically provisioned through a StorageClass. A PersistentVolume represents the actual storage resource, while StorageClass defines classes of storage and provisioning behavior. ConfigMaps store configuration rather than persistent data. PVCs therefore provide the standard abstraction that applications use when requesting persistent storage.

Question 359

What is the purpose of a StorageClass in Kubernetes?

  1. To define classes and provisioning behavior for storage
  2. To store application passwords
  3. To assign Pod IP addresses
  4. To authenticate users

Correct Answer: 1

Explanation

A StorageClass describes a class of storage and can define how persistent storage should be dynamically provisioned. It can reference a storage provisioner and include parameters that determine characteristics of the resulting storage. When a PVC requests a particular StorageClass, Kubernetes can use the configured provisioning mechanism to create an appropriate PersistentVolume. StorageClasses do not store passwords, assign Pod IP addresses, or authenticate users. They provide an abstraction that helps administrators offer different storage options to workloads.

Question 360

Which Kubernetes component is responsible for maintaining the state of many built-in resources through control loops?

  1. kube-proxy
  2. kube-controller-manager
  3. CoreDNS
  4. containerd

Correct Answer: 2

Explanation

The kube-controller-manager runs multiple Kubernetes controllers that continuously work to maintain the desired state of cluster resources. Examples include controllers associated with Deployments, ReplicaSets, Nodes, Jobs, and other built-in functionality. These controllers observe the cluster through the API and take corrective actions when the current state differs from the desired state. kube-proxy handles networking functions, CoreDNS provides DNS services, and containerd is a container runtime. The controller manager is therefore central to Kubernetes’ reconciliation-based architecture.