Linux Foundation KCNA Practice Test Questions and Exam Dumps Part8 Q141-160

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

 

Question 141

Which Kubernetes object is used to route external HTTP and HTTPS requests to Services based on hostnames or URL paths?

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

Correct Answer: 2

Explanation

An Ingress defines rules for routing HTTP and HTTPS traffic to Kubernetes Services. It can route requests based on hostnames, URL paths, or other supported matching rules. An Ingress resource itself describes the desired routing configuration, while an Ingress controller is responsible for implementing those rules. ConfigMaps store configuration, Secrets store sensitive data, and ReplicaSets maintain Pod replicas. Ingress is therefore commonly used when multiple web applications need to be exposed through shared external HTTP or HTTPS entry points.

Question 142

Which component implements the routing rules defined by an Ingress resource?

  1. Ingress controller
  2. kubelet
  3. etcd
  4. kube-scheduler

Correct Answer: 1

Explanation

An Ingress controller watches Ingress resources and implements their routing rules using a specific networking or proxy technology. The Ingress resource describes how incoming HTTP or HTTPS traffic should be routed, while the controller performs the actual traffic handling. Different Kubernetes environments can use different Ingress controller implementations. The kubelet manages Pods on nodes, etcd stores cluster state, and kube-scheduler places Pods. Understanding the distinction between the Ingress resource and its controller is important because creating an Ingress object alone does not necessarily provide traffic handling without an appropriate controller.

Question 143

Which Kubernetes Service type does not assign a virtual cluster IP and can return individual Pod IP addresses through DNS?

  1. NodePort
  2. LoadBalancer
  3. Headless Service
  4. ClusterIP

Correct Answer: 3

Explanation

A headless Service is configured without a conventional cluster IP, commonly by setting clusterIP to None. Instead of providing a single virtual IP, DNS queries can return the addresses of individual Pods selected by the Service. This is useful for applications that need direct endpoint discovery, particularly some stateful or distributed systems. ClusterIP provides a virtual internal address, NodePort exposes a node-level port, and LoadBalancer can integrate with external load-balancing infrastructure. Headless Services therefore provide a different form of service discovery focused on individual endpoints.

Question 144

Which Kubernetes object can provide stable network identities for Pods managed by a StatefulSet?

  1. Headless Service
  2. Job
  3. ConfigMap
  4. ResourceQuota

Correct Answer: 1

Explanation

A headless Service can work with StatefulSets to provide stable DNS identities for individual Pods. StatefulSet Pods have predictable names, and a headless Service allows DNS-based discovery of those individual Pod endpoints. This is particularly useful for distributed applications where each instance may need to be contacted directly. Jobs are designed for finite tasks, ConfigMaps store configuration, and ResourceQuotas control resource consumption. The combination of StatefulSet and a headless Service is a common Kubernetes pattern for applications requiring stable network identities.

Question 145

Which Kubernetes object is used to group resources and control their organizational scope?

  1. Namespace
  2. Pod
  3. Container
  4. Node

Correct Answer: 1

Explanation

A Namespace provides a logical grouping and scope for many Kubernetes resources. Organizations can use namespaces to separate development, testing, production, teams, or applications within a shared cluster. Namespaces can also be used with RBAC permissions and ResourceQuotas to establish access and resource boundaries. Pods contain application containers, Nodes provide compute resources, and containers run application processes. Namespaces are therefore an important organizational mechanism for managing resources in clusters that host multiple teams or workloads.

Question 146

Which Kubernetes command is used to view the available contexts configured for kubectl?

  1. kubectl context list
  2. kubectl config get-contexts
  3. kubectl contexts
  4. kubectl get contexts

Correct Answer: 2

Explanation

The kubectl config get-contexts command displays the contexts configured in the kubeconfig file. A context associates a cluster, user credentials, and optionally a namespace, allowing kubectl to determine where and how commands should be executed. This is particularly useful when working with multiple Kubernetes clusters. The command helps administrators inspect available contexts before selecting one. kubectl config use-context can then be used to switch to a particular context. Understanding kubectl contexts helps prevent accidental operations against the wrong cluster.

Question 147

Which kubectl command switches the active context used for subsequent commands?

  1. kubectl config use-context
  2. kubectl switch-cluster
  3. kubectl context-select
  4. kubectl use-cluster

Correct Answer: 1

Explanation

The kubectl config use-context command changes the active context used by kubectl. A context typically contains information about a cluster, user credentials, and a namespace. This allows administrators to work with multiple Kubernetes environments without manually specifying connection details for every command. Before switching contexts, administrators can use kubectl config get-contexts to inspect the configured choices. Using the correct context is especially important in environments containing development, staging, and production clusters because kubectl operations affect whichever context is currently active.

Question 148

Which Kubernetes resource allows administrators to define minimum and maximum resource consumption for individual containers?

  1. Service
  2. Resource requests and limits
  3. Namespace
  4. Ingress

Correct Answer: 2

Explanation

Container resource requests and limits define CPU and memory expectations and boundaries for workloads. Requests help the scheduler determine whether a node has enough available capacity for a Pod. Limits establish maximum resource usage for supported resources. Properly configured requests and limits improve scheduling decisions and help prevent individual workloads from consuming excessive resources. Services provide networking, Namespaces organize resources, and Ingress handles HTTP routing. Resource management is particularly important in multi-tenant clusters where many applications compete for shared CPU and memory capacity.

Question 149

Which Kubernetes resource can limit the number of Pods or total CPU and memory consumed within a namespace?

  1. NetworkPolicy
  2. ResourceQuota
  3. StorageClass
  4. Ingress

Correct Answer: 2

Explanation

ResourceQuota allows administrators to establish aggregate resource limits within a namespace. Depending on the configuration, quotas can limit CPU, memory, the number of Pods, Services, PersistentVolumeClaims, and other supported resource types. This helps prevent one namespace from consuming an excessive amount of cluster capacity. NetworkPolicies control network traffic, StorageClasses define storage provisioning behavior, and Ingress manages HTTP or HTTPS routing. ResourceQuota works at the namespace level, making it useful for managing resource consumption across teams, applications, or environments sharing a Kubernetes cluster.

Question 150

Which Kubernetes mechanism controls whether a user or ServiceAccount can perform actions on resources?

  1. RBAC
  2. CNI
  3. CSI
  4. CRI

Correct Answer: 1

Explanation

Role-Based Access Control, or RBAC, controls authorization within Kubernetes. It determines which actions an identity such as a user, group, or ServiceAccount can perform on Kubernetes resources. RBAC uses resources such as Roles, ClusterRoles, RoleBindings, and ClusterRoleBindings to define and assign permissions. CNI is associated with networking, CSI with storage integration, and CRI with container runtime integration. RBAC is therefore a major Kubernetes security mechanism and is commonly used to implement least-privilege access for administrators, developers, and applications.

Question 151

Which Kubernetes interface provides a standard mechanism for integrating storage plugins with Kubernetes?

  1. CRI
  2. CNI
  3. CSI
  4. RBAC

Correct Answer: 3

Explanation

CSI, or Container Storage Interface, provides a standardized interface for integrating storage systems with Kubernetes. CSI drivers allow Kubernetes to perform storage-related operations such as provisioning, attaching, mounting, and managing volumes. This abstraction allows different storage vendors and platforms to integrate with Kubernetes without requiring Kubernetes itself to contain vendor-specific storage implementation details. CRI handles container runtimes, CNI handles networking, and RBAC manages authorization. CSI is therefore the primary interface to understand when studying Kubernetes storage integration.

Question 152

Which interface is used by Kubernetes to integrate with container networking implementations?

  1. CNI
  2. CSI
  3. CRI
  4. API

Correct Answer: 1

Explanation

CNI stands for Container Network Interface and provides a standard approach for configuring networking for containers and Pods. Kubernetes networking implementations commonly use CNI plugins to assign Pod IP addresses, configure network interfaces, and provide connectivity between workloads. CSI handles storage integration, while CRI provides the interface for container runtime operations. The Kubernetes API is used for communication with cluster resources but is not the networking plugin interface. CNI is therefore an important component when studying how Kubernetes establishes Pod networking.

Question 153

Which interface allows Kubernetes to communicate with container runtimes?

  1. CNI
  2. CRI
  3. CSI
  4. RBAC

Correct Answer: 2

Explanation

The Container Runtime Interface, or CRI, provides a standardized interface between Kubernetes and compatible container runtimes. Through CRI, Kubernetes can request operations needed to create and manage containers and Pods. This design separates Kubernetes orchestration logic from the implementation details of the container runtime. CNI provides networking, CSI provides storage integration, and RBAC controls authorization. Understanding CRI is useful when studying Kubernetes architecture because container runtime responsibilities are separate from scheduling, API management, networking, and storage functions.

Question 154

Which Kubernetes object represents a running instance of an application workload and can contain one or more containers?

  1. Pod
  2. Service
  3. Namespace
  4. ClusterRole

Correct Answer: 1

Explanation

A Pod is the smallest deployable unit in Kubernetes and can contain one or more containers that share networking and storage resources. Containers within the same Pod share a network namespace and can communicate through localhost. Pods are usually managed by higher-level workload resources such as Deployments, StatefulSets, DaemonSets, and Jobs rather than being created manually for long-running applications. Services provide networking to groups of Pods, Namespaces organize resources, and ClusterRoles define permissions. Understanding Pods is fundamental because most Kubernetes workloads ultimately execute inside Pods.

Question 155

Which Kubernetes object selects Pods using labels and provides a stable endpoint for accessing them?

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

Correct Answer: 1

Explanation

A Kubernetes Service can use label selectors to identify the Pods that should receive network traffic. The Service provides a stable endpoint even when individual backend Pods are recreated and their IP addresses change. This separation between clients and Pod lifecycles is one of the main reasons Services are central to Kubernetes networking. Secrets store sensitive information, Jobs manage finite tasks, and ConfigMaps store configuration. By selecting Pods through labels, a Service can dynamically include or remove matching workloads as the cluster state changes.

Question 156

Which Kubernetes feature is primarily responsible for maintaining the desired number of replicas for a Deployment?

  1. Ingress
  2. ReplicaSet
  3. ConfigMap
  4. ServiceAccount

Correct Answer: 2

Explanation

A ReplicaSet maintains the desired number of matching Pods for a Deployment. When a Deployment is created, it normally creates a ReplicaSet, which then ensures that the required number of Pods exists. If a Pod is deleted or fails, the ReplicaSet controller can create a replacement. Deployments add higher-level functionality such as rolling updates and revision management. Ingress handles HTTP routing, ConfigMaps store configuration, and ServiceAccounts provide identities. ReplicaSets therefore provide the replica-maintenance mechanism underneath typical Kubernetes Deployments.

Question 157

Which Kubernetes resource is best suited for a workload that must run continuously on every eligible node?

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

Correct Answer: 3

Explanation

A DaemonSet is designed for workloads that need a Pod on every eligible node. Common examples include node monitoring agents, log collection agents, and certain networking components. When a new eligible node joins the cluster, the DaemonSet can create the required Pod there automatically. Jobs and CronJobs are designed for finite or scheduled tasks, while Deployments manage a desired number of replicas without requiring one replica per node. DaemonSet is therefore the appropriate workload resource when node-level coverage is required across a Kubernetes cluster.

Question 158

Which Kubernetes resource is appropriate for a task that should execute once and then finish?

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

Correct Answer: 3

Explanation

A Job is designed for finite workloads that should run until successful completion. Examples include database migrations, batch calculations, data processing, and maintenance tasks. The Job controller creates Pods and monitors their completion status, with retry behavior available for failures. StatefulSets are intended for stateful applications, Services provide network endpoints, and DaemonSets ensure workloads run on eligible nodes. Jobs are therefore a natural fit when the primary requirement is completing a task rather than keeping an application continuously available.

Question 159

Which Kubernetes resource is designed for recurring tasks that execute according to a schedule?

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

Correct Answer: 2

Explanation

A CronJob schedules the creation of Jobs according to a defined schedule. It is useful for recurring workloads such as backups, cleanup operations, periodic reports, and scheduled data processing. Each execution results in a Job, which manages the Pods required to complete that specific run. Deployments continuously manage application replicas, ReplicaSets maintain Pod counts, and StatefulSets manage stateful applications with stable identities. CronJobs therefore provide the scheduling layer needed when a finite task must execute repeatedly at predetermined times.

Question 160

Which Kubernetes mechanism automatically attempts to restore the desired state when a managed Pod fails?

  1. Self-healing
  2. Manual provisioning
  3. Static scheduling
  4. Image building

Correct Answer: 1

Explanation

Kubernetes self-healing is enabled by controllers that continuously reconcile actual cluster state with the desired state. If a managed Pod fails or is removed, a controller such as a ReplicaSet controller can detect the difference and create a replacement. This behavior reduces the need for administrators to manually recover many common workload failures. Self-healing applies to supported Kubernetes-managed resources, but it does not guarantee that application-level problems will automatically be fixed. The concept is closely connected to Kubernetes’ declarative model and continuous reconciliation architecture.