Linux Foundation
Certified Kubernetes Application Developer (CKAD)
Question 1 of 597A security audit has flagged that several application pods are running as the root user, which violates the organization's hardening standards. You are tasked with updating the deployment for a Python web app to ensure that it runs with the user ID 1001, belongs to the group ID 2001, and is strictly prohibited from gaining more privileges than its parent process. Which configuration block in the Pod specification is required to enforce these settings?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. A securityContext block at the container level defining runAsUser, runAsGroup, and allowPrivilegeEscalation: false.
The container-level securityContext is the correct block because it directly defines runAsUser, runAsGroup, and allowPrivilegeEscalation to enforce these specific runtime constraints. A NetworkPolicy or RBAC bindings cannot enforce user IDs or prevent privilege escalation inside a running container.
Question 2 of 597You are managing an Ingress resource that handles traffic for an internal HR portal. To secure the communication, you have been provided with a TLS certificate and a private key. You have already created a Secret named 'hr-tls-secret' containing these credentials. What is the next step to enable HTTPS on the Ingress resource for the host 'hr.example.com'?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Update the Ingress specification by adding a 'tls' block that specifies the hosts and references the 'hr-tls-secret' name.
Adding a TLS block to the Ingress specification referencing the existing Secret enables TLS termination for the specified host. You do not need to modify the Service or manually mount certificate volumes into the Ingress controller deployment.
Question 3 of 597An engineering team is managing a multi-tenant cluster where the 'payment-processing' namespace handles highly sensitive transactions. A new compliance rule dictates that pods with the label 'role: backend' in this namespace should only accept incoming traffic from pods labeled 'role: frontend' located within the same 'payment-processing' namespace on TCP port 443. All other incoming traffic from other namespaces or other pods must be blocked. Which Kubernetes resource configuration achieves this isolation?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. A NetworkPolicy with an ingress rule that selects 'role: frontend' pods and specifies port 443 under the 'role: backend' pod selector
A NetworkPolicy isolates the backend pods by selecting them and defining an ingress rule that permits traffic only from the frontend pod selector on TCP port 443. RBAC roles control API permissions rather than network access between pods.
Question 4 of 597A distributed application consists of a 'frontend' deployment and a 'database' deployment in the same namespace. To comply with internal security standards, the database must be isolated so that it only accepts incoming connections on TCP port 5432 from pods specifically labeled with 'app: web-frontend'. You need to define the network rules to enforce this restriction while ensuring the database can still reach the cluster DNS for service discovery.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Create a NetworkPolicy with an ingress rule matching the frontend podSelector and a port 5432
A NetworkPolicy applied to the database pods with an ingress rule restricting port 5432 to the frontend pod selector effectively isolates the database. By default, NetworkPolicies allow egress traffic unless specifically restricted, so cluster DNS remains accessible.
Question 5 of 597A deployment of 'v1.0.0' of a web application is currently running with 5 replicas. The development team wants to deploy 'v2.0.0' using a strategy that ensures at least 4 replicas are always available to handle traffic, and no more than 7 replicas are running in the cluster at any given time during the transition. Which RollingUpdate strategy parameters should the developer configure in the Deployment manifest?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set maxUnavailable to 1 and maxSurge to 2 to maintain the required availability and resource usage limits during the update.
Configuring maxUnavailable to 1 ensures 4 replicas stay available, while maxSurge set to 2 limits the maximum total replicas to 7 during the rollout. Using percentages introduces fractional replicas and unpredictable scaling limits.
Question 6 of 597In a multi-tenant cluster, the 'marketing' team is complaining that their pods are being evicted because the 'data-science' team's pods are consuming all available CPU on the nodes. You need to implement a solution in the 'data-science' namespace that restricts any individual pod from requesting more than 500m CPU and also ensures the entire namespace cannot consume more than 4000m CPU in total. Which resources must be created?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. A LimitRange to set default and maximum constraints on individual pods and a ResourceQuota to limit the total namespace usage.
A LimitRange enforces the maximum CPU limit per individual pod, while a ResourceQuota caps the total aggregate CPU usage across the namespace. PodSecurityPolicies are deprecated, and NetworkPolicies do not restrict compute resource consumption.
Question 7 of 597A data science team is running intensive Python scripts in a shared cluster. Occasionally, these scripts consume all available memory on a node, causing other critical system components to fail or enter an unstable state. You must enforce memory constraints to ensure that no single pod can exceed 2GB of RAM, and if it does, it should be terminated to protect the node.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Configure the memory limits field to 2Gi in the container's resource specification
Setting the container memory limits field to 2Gi triggers an Out Of Memory kill if the application attempts to exceed that threshold. A ResourceQuota caps total namespace usage rather than terminating individual offending pods.
Question 8 of 597A data science team needs to run a large-scale data transformation task consisting of 50 independent chunks of data. Each chunk takes about 5 minutes to process. To finish the entire task as quickly as possible without overwhelming the cluster's resources, the team wants to process exactly 5 chunks simultaneously at all times until all 50 chunks are successfully completed. Which configuration for a Kubernetes Job should be used to achieve this specific parallel execution behavior?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set completions: 50 and parallelism: 5 in the Job specification
The correct answer uses completions for the total successful pods and parallelism for the concurrent workers. Do not confuse this with Deployments, which use replicas for steady-state services.
Question 9 of 597A high-performance computing task involves processing 100 independent data chunks. Each chunk takes about 5 minutes to process. To meet a strict deadline, the DevOps team decides to use a Kubernetes Job that can process multiple chunks in parallel. They want exactly 10 pods to be running at any given time until all 100 chunks are successfully processed. Which parameters in the Job spec should be configured to achieve this behavior?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set completions to 100 and parallelism to 10 to ensure a steady state of 10 concurrent workers
The correct answer sets completions to the total desired successes and parallelism to the concurrent worker count. Avoid swapping these values or mixing in activeDeadlineSeconds, which only sets a timeout.
Question 10 of 597A security auditor has mandated that a specific Pod named 'payment-processor' in the 'finance' namespace must be restricted at the network level. The Pod is allowed to send traffic to an internal legacy database located at the IP address 10.50.0.22, but it must be strictly prohibited from initiating any other outbound connections to the internet or other internal services. You are creating a NetworkPolicy to enforce this. Which section of the NetworkPolicy manifest should you focus on to define these egress restrictions?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Specify an egress rule with a to block containing an ipBlock for 10.50.0.22/32
The correct answer uses an egress rule with an ipBlock targeting the database IP. Once an egress policy applies, Kubernetes isolates the pod and blocks all unspecified outbound traffic.
Question 11 of 597A cluster is running at near-full capacity with several background data-processing Pods. A critical 'emergency-alert' Pod must be deployed immediately and guaranteed to run, even if it means terminating existing low-priority Pods to free up resources. The cluster administrator has already created several PriorityClasses: 'high-priority' (value: 1000000) and 'low-priority' (value: 1000). How should the developer configure the 'emergency-alert' Pod to ensure the scheduler preempts lower priority workloads?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Assign the 'priorityClassName: high-priority' field in the Pod's spec to indicate its importance to the Kubernetes scheduler
The correct answer assigns the priorityClassName field in the pod spec. The scheduler uses this exact field to determine priority and evict lower-priority workloads, whereas labels and autoscalers do not trigger preemption.
Question 12 of 597Your organization is deploying a microservice that requires access to a sensitive database password and a shared configuration file containing API endpoints. According to the strict security policy, sensitive information must not be exposed as environment variables within the container to prevent accidental leaks in logs or process dumps. The application expects the password to be available at /etc/secrets/db-password and the configuration at /etc/config/settings.yaml. How should you configure the Pod specification to meet these requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Mount the Secret and ConfigMap as separate volumes and use volumeMounts to map them to the specific directory paths
Mounting Secrets and ConfigMaps as volumes projects the data as files at the specified paths. Using envFrom would inject values as environment variables, violating the strict security policy.
Question 13 of 597A complex Java-based microservice takes approximately 90 seconds to initialize its internal cache and establish connections to backend databases. During the deployment process, the developer notices that Kubernetes restarts the container several times before it becomes stable. The current configuration includes a livenessProbe with an initialDelaySeconds of 10. How should the developer adjust the probe configuration to ensure the application starts successfully without being prematurely terminated?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Replace the livenessProbe with a startupProbe that has a sufficient failureThreshold and periodSeconds for the 90-second delay.
A startupProbe correctly disables liveness checks during initialization, preventing premature restarts for slow-starting apps. Relying only on livenessProbe delays risks killing the container before it fully boots.
Question 14 of 597A high-traffic e-commerce platform uses a legacy binary that outputs internal transaction logs to a local file system path /opt/app/logs/output.log. The platform team needs to stream these logs to a central Fluentd collector without altering the legacy application source code or its container image. They decide to implement a multi-container Pod pattern to handle this requirement efficiently within the Kubernetes cluster. Which implementation strategy should the developer use to meet these requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Deploy a sidecar container sharing an emptyDir volume with the main application to tail the log file to stdout.
A sidecar container sharing an emptyDir volume correctly tails the log file and streams it to stdout. This pattern extends the main container's functionality without modifying its source code or image.
Question 15 of 597You are investigating a performance issue in a shared development namespace. One application container is consuming an excessive amount of CPU, which is starving other critical development tools in the same namespace. To prevent this 'noisy neighbor' effect in the future, you want to enforce a policy that requires every container in this namespace to specify its own resource limits. If a container does not specify them, it should be assigned a default limit automatically. Which Kubernetes object should you configure?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. A LimitRange object defined within the namespace to set default requests and limits for CPU and Memory.
A LimitRange is the correct object to automatically enforce default CPU and memory limits for individual containers. A ResourceQuota caps total namespace usage but does not assign default limits per pod.
Question 16 of 597A data processing application needs to process a backlog of 100 files stored in an S3 bucket. To optimize performance, the team wants to run exactly 5 worker pods simultaneously until all 100 files are processed. Each pod processes one file and then terminates. Which configuration in a Kubernetes Job object will ensure this specific level of parallelism and total completion count?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Define a Job with completions: 100 and parallelism: 5 to manage the lifecycle of the worker pods.
A Job specifically manages batch tasks using parallelism to limit concurrent pods and completions to set the total success count. Deployments and ReplicaSets are meant for long-running services, not tasks that terminate after processing.
Question 17 of 597A security policy requires that all Pods in the 'finance-prod' namespace must follow the 'Restricted' Pod Security Standard. Specifically, the application must run with a non-root user, must not be allowed to escalate its privileges, and must have its root filesystem mounted as read-only to prevent unauthorized modifications of the container image at runtime. You are configuring the PodSpec for a new transaction-processor microservice. Which combination of securityContext settings at the container level will satisfy these specific requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. runAsNonRoot: true, allowPrivilegeEscalation: false, and readOnlyRootFilesystem: true
This combination directly enforces non-root execution, prevents privilege escalation, and makes the root filesystem immutable. Option C misses the required read-only filesystem, and Option B adds unnecessary complexity without meeting all criteria.
Question 18 of 597A complex analytics application requires a specific configuration file to be available in a shared volume before the main application container starts. This file is generated by a legacy script that requires a different base image and specific environment variables not needed by the main application. The generation process must finish successfully before the application begins its startup sequence. If the file generation fails, the application should not start at all. What is the most efficient way to implement this dependency within the Pod specification?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Use an InitContainer to run the legacy script and write the file to a shared volume
An InitContainer runs to completion before the main container starts, blocking startup if it fails. Sidecars and lifecycle hooks run concurrently with the app, meaning they cannot guarantee the file exists before the main process begins.
Question 19 of 597Your application deployment named 'transaction-manager' must ensure that no more than one instance of the pod is running at any given time because it uses an exclusive file lock on a shared network storage volume. When updating the application to a new version, the existing pod must be completely terminated and its resources released before the new version starts to avoid lock contention. The standard rolling update process is causing failures because the new pod starts before the old one is deleted. Which deployment configuration change is required?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set the 'strategy' type to 'Recreate' to ensure all existing pods are killed before any new pods are created during the update.
The Recreate strategy terminates all existing pods before creating new ones, preventing concurrent access. RollingUpdate attempts to scale new pods while old ones are still terminating, which would cause lock contention.
Question 20 of 597An application is known to experience occasional internal deadlocks where the main process remains active but fails to process any further incoming requests. The container runtime does not detect this as a crash because the PID 1 process is still alive. You need to implement a mechanism that allows the Kubernetes control plane to automatically detect this unhealthy state and perform a container restart.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Implement a LivenessProbe that checks an internal health endpoint for responsiveness
A LivenessProbe detects unrecoverable states like deadlocks and triggers the kubelet to restart the container. A ReadinessProbe would only remove the pod from service, but it would not restart the deadlocked process.
Question 21 of 597An organization is deploying an application that requires access to a sensitive API key stored in a Secret named 'api-credentials'. The security policy dictates that the secret must not be exposed as an environment variable to prevent it from being logged by the application process or visible in the container metadata. Instead, the application expects the key to be available as a file at the path '/etc/api/key.txt'. How should the Pod be configured to satisfy this security requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Configure a volume of type 'secret' in the Pod spec and mount it as a volumeMount at the specified path in the container.
Mounting a Secret as a volume writes the data to a memory-backed filesystem at the exact target path. This avoids accidental exposure via environment variables in process listings or application crash logs.
Question 22 of 597A Python-based data processing application occasionally enters a deadlock state due to resource contention. In this state, the process remains running, so the container does not exit, but it stops consuming messages from the internal queue. You need to configure a mechanism that detects this stall and triggers a container restart to recover the service. Which configuration is most appropriate?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Configure a LivenessProbe that executes a script checking for recent activity in the application processing logs.
A LivenessProbe using an exec action checks application activity and restarts the container if the probe fails. A ReadinessProbe only removes the pod from the service endpoints without restarting the deadlocked process.
Question 23 of 597A legacy enterprise application writes its operational logs directly to a static file located at /opt/app/logs/server.log inside the container. The corporate logging policy requires these logs to be streamed to stdout so they can be captured by the cluster-wide Fluentd collector. You cannot modify the original application code or the container image. How should you design the Pod to meet this requirement using a common Kubernetes pattern?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Add a sidecar container to the Pod that shares a volume with the main container and runs a command to tail the log file to its own stdout.
A sidecar container shares a volume with the main app and tails the log file to its own standard output. This streams the logs to the Kubernetes infrastructure without modifying the original application image.
Question 24 of 597A development team is preparing to update a critical data-migration application from version 2.0 to 3.0. The update includes a non-backward compatible database schema change. If version 2.0 and version 3.0 run simultaneously, the older version will crash when it encounters the new schema, potentially leaving the database in an inconsistent state. The team requires a deployment strategy that ensures the old version is completely terminated before any new pods are started. Which strategy should be defined in the Deployment manifest?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set the strategy type to Recreate to ensure all existing Pods are killed before new ones are created
Setting the strategy type to Recreate guarantees all old pods are killed before new ones are created. A RollingUpdate would temporarily run both versions concurrently, crashing the older pods accessing the new schema.
Question 25 of 597An external legacy monitoring system needs to collect metrics from a Prometheus exporter running as a Service inside your Kubernetes cluster. The monitoring system is located on the same physical network as the cluster nodes but cannot use an Ingress. It requires a fixed port that is accessible on every node's IP address. Which Service type should you implement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Configure a Service of type NodePort and specify a value in the nodePort field between 30000 and 32767.
A NodePort service exposes the application on a static port across all cluster nodes. ClusterIP is internal only, while LoadBalancer relies on cloud provider integration rather than direct node access.
Question 26 of 597A data engineer is managing a stateful workload that stores critical logs on a PersistentVolume (PV) backed by cloud-specific block storage. The engineer is concerned that if the PersistentVolumeClaim (PVC) is accidentally deleted by an automated cleanup script, the underlying data and the physical storage volume will be immediately purged by the cloud provider. Which configuration must be applied to the PersistentVolume to ensure the physical data remains intact even if the PVC is removed?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Update the persistentVolumeReclaimPolicy of the PV to the value Retain
The Retain reclaim policy ensures the underlying storage asset and data are preserved when the PersistentVolumeClaim is deleted. On the exam, recall that the default policy for dynamically provisioned cloud volumes is Delete, so you must explicitly patch the PersistentVolume to Retain.
Question 27 of 597The development team is working in a shared Kubernetes namespace that has a ResourceQuota enforced. This quota requires every Pod to have explicit CPU and memory requests and limits defined. You are deploying a resource-intensive data processing Pod that occasionally spikes in CPU usage. If you define only the CPU limits without specifying CPU requests in your Pod manifest, how will the Kubernetes control plane handle the Pod creation request in this restricted namespace?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Kubernetes will automatically set the requests to match the defined limits
In a restricted namespace, Kubernetes automatically sets the CPU and memory requests to match the defined limits if limits are omitted. The default request of zero is incorrect because ResourceQuota validation requires explicit values, which it derives from the limits.
Question 28 of 597Your company manages a web platform where the main site is hosted at example.com, and a separate search service is hosted at example.com/search. Each is managed by a different Deployment and Service. You need to configure a single entry point that routes traffic to the appropriate backend Service based on the URL path. What is the most efficient Kubernetes resource to manage this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. An Ingress resource with path-based rules mapping / and /search to their respective backend services.
An Ingress resource handles Layer 7 routing based on URL paths, efficiently mapping different routes to backend services. Using a LoadBalancer service is incorrect because it lacks native HTTP path-awareness, and manually updating endpoints is not a standard Kubernetes pattern.
Question 29 of 597A stateful database application needs to be deployed in a Kubernetes cluster. The database requires high-performance disk access and the data must persist even if the Pod is rescheduled to a different node. The cluster uses an external cloud storage provider that supports volume attaching to a single node at a time. Which PersistentVolume access mode and volume type should the developer choose for this database deployment?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use ReadWriteOnce (RWO) access mode with a PersistentVolumeClaim to ensure exclusive access for the single database Pod.
ReadWriteOnce allows a single node to mount the cloud block storage for exclusive read-write access, protecting the database. ReadWriteMany is incorrect because cloud block storage typically does not support multi-node simultaneous writing.
Question 30 of 597Your team needs to schedule a recurring data validation task that runs every hour. A critical requirement is that if a task instance takes longer than 60 minutes to complete, the next scheduled instance must not start until the current one has finished, to avoid overlapping database writes and potential data corruption. Which configuration field in the CronJob manifest is essential to enforce this behavior?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Configure 'concurrencyPolicy' to 'Forbid' to prevent the controller from starting a new Job if the previous one is still running.
Setting concurrencyPolicy to Forbid prevents overlapping Job executions by skipping new runs if a previous one is active. backoffLimit is incorrect because it limits failure retries rather than controlling concurrent schedules.
Question 31 of 597Your team is preparing to launch a new version of the 'order-processor' application. To minimize risk, you want to perform a canary deployment where only 10% of the production traffic is directed to the new version (v2), while the remaining 90% stays on the stable version (v1). Both versions should be accessible via the same Service named 'order-service'. How can you achieve this using standard Kubernetes Deployment and Service objects without an Ingress controller or Service Mesh?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Create two separate Deployments (v1 and v2) with the same labels used by the Service's selector, and adjust the replica counts to a 9:1 ratio.
A Kubernetes Service load-balances across all Pods matching its label selector. Creating two Deployments with identical labels and a 9:1 replica ratio achieves the 10% traffic split. Setting an image list is invalid because Deployments only run a single image per container template.
Question 32 of 597A network security audit has identified that several Pods in the 'internal-services' namespace have unrestricted access to the public internet. The corporate policy mandates that all Pods in this namespace must be prohibited from making any outbound connections, except for communication to a specific internal DNS server located at 10.10.10.53 on UDP port 53. You are tasked with creating a NetworkPolicy that enforces these egress rules while maintaining normal operation for internal DNS resolution. How should the egress section of the NetworkPolicy be structured?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Define an egress rule with a 'to' block containing an 'ipBlock' for 10.10.10.53/32 and a 'ports' block for UDP port 53.
Specifying an ipBlock destination and specific port creates an explicit allow-list for egress traffic, denying everything else by default. An empty or undefined egress list blocks all outbound traffic entirely, breaking DNS resolution and violating the functional requirement.
Question 33 of 597A team is migrating a microservices architecture to Kubernetes. One of the internal services needs to communicate with an Oracle database that is currently hosted on a physical server outside the cluster. To keep the application configuration consistent with other internal services, the team wants to use a standard Kubernetes DNS name like 'db-service.production.svc.cluster.local' to reach the external database. Which type of Kubernetes Service should be created to map this internal DNS name to the external IP or FQDN of the Oracle database?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. A Service of type ExternalName that points to the external database FQDN
The ExternalName service type maps a service to a DNS name by returning a CNAME record with the external address. Other options like ClusterIP or LoadBalancer are intended for routing traffic to cluster pods rather than providing lightweight aliasing to external FQDNs.
Question 34 of 597Your team is deploying a microservice that needs to connect to an external database. Due to a recent network security audit, you are required to restrict egress traffic from the microservice Pod so that it can only communicate with the specific CIDR block of the database server and is blocked from accessing any other external or internal IP addresses. The Pod is labeled 'app: processor' in the 'finance' namespace. What is the correct approach to implement this restriction using native Kubernetes resources?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Create a NetworkPolicy in the finance namespace with an egress rule specifying the target CIDR and an empty podSelector.
A NetworkPolicy with an egress section allows you to define white-listed destinations based on CIDR blocks and labels. Defining allowed egress CIDRs isolates traffic, as all other outbound paths are automatically denied once the policy applies.
Question 35 of 597A retail company uses a legacy inventory management application that outputs log files in a proprietary binary format to a local volume. The company monitoring stack only supports JSON format via a centralized collector. You are tasked with implementing a Kubernetes-native solution that transforms these logs in real-time without modifying the core application code or its image. Which design pattern should be applied to meet this requirement while maintaining clear separation of concerns?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Deploy an Adapter container that reads the binary logs and exports them in JSON format
The Adapter container pattern standardizes or translates application output, converting proprietary logs into JSON format for monitoring tools. An init container runs only once before the app starts, so it cannot handle continuous, real-time log transformation during the application lifecycle.
Question 36 of 597An engineering team is attempting to deploy a suite of resource-intensive microservices into a dedicated namespace called accounting-prod. During the rollout, several Pods remain in a Pending state. An inspection of the events reveals a message stating that the requested CPU and memory exceed the limits defined by a ResourceQuota object in the namespace. However, the cluster has ample physical capacity. You must resolve this by ensuring that every container in the namespace is automatically assigned a default resource consumption profile if none is specified by the developer. Which Kubernetes object should you implement to automate this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Create a LimitRange object in the accounting-prod namespace to define default requests and limits
A LimitRange sets default request and limit values for containers, automatically injecting them if a pod lacks explicit resource definitions. This ensures pods comply with namespace ResourceQuotas, resolving the pending state without manually adjusting individual deployments.
Question 37 of 597A complex data-processing application requires a specific configuration directory to be populated with a large dataset from an external S3 bucket before the main application starts. The main application image is stripped of all utilities for security reasons. How can you ensure the data is available in the shared volume /data before the application begins its execution?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Utilize an InitContainer with an image that includes the AWS CLI to download the data into a shared emptyDir volume.
Init containers run to completion before the main application starts, preparing shared volumes safely using specialized tools. A postStart hook executes concurrently with the main container, creating a race condition where the app might access the directory before the download finishes.
Question 38 of 597A high-availability web portal named portal-web is being deployed into a production cluster that spans three distinct availability zones (zone-a, zone-b, and zone-c). The deployment consists of 12 replicas. To maintain service continuity during a regional failure, you must ensure that these replicas are distributed evenly across the zones. The requirement specifies that if the scheduler cannot achieve a perfectly even distribution due to resource constraints in one zone, it must still schedule the pod rather than leaving it in a Pending state. Which pod specification configuration correctly implements this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set topologySpreadConstraints with maxSkew: 1, topologyKey: topology.kubernetes.io/zone, and whenUnsatisfiable: ScheduleAnyway.
Setting whenUnsatisfiable to ScheduleAnyway within topologySpreadConstraints creates a soft rule, prioritizing even spread while guaranteeing the pod schedules during resource constraints. Using DoNotSchedule acts as a hard constraint, leaving the pod pending if exact distribution fails.
Question 39 of 597A production deployment currently running 10 replicas needs to be updated to a new version. The cluster has limited available resources, and you cannot exceed 12 total pods at any time during the transition to avoid node pressure. However, to maintain user experience, the application must never have fewer than 9 replicas available at any given moment. Which RollingUpdate strategy configuration correctly fulfills these constraints?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Define the maxSurge as 2 and the maxUnavailable as 1 in the deployment specification
A maxSurge of 2 permits scaling up to 12 pods maximum, preventing node pressure during the update. A maxUnavailable of 1 guarantees at least 9 replicas remain ready, satisfying the minimum capacity requirement throughout the rollout process.
Question 40 of 597A microservices architecture consists of a 'frontend' application in the 'web-dev' namespace and a 'catalog-db' service in the 'data-services' namespace. The developers are reporting that the frontend cannot reach the database using the short name 'catalog-db'. You need to provide the correct internal Fully Qualified Domain Name (FQDN) that follows the Kubernetes DNS standard so that the frontend can communicate with the database service across namespace boundaries. What is the correct FQDN for the 'catalog-db' service?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. catalog-db.data-services.svc.cluster.local
The standard Kubernetes service FQDN format is service-name.namespace.svc.cluster.local, which allows cross-namespace resolution via CoreDNS. Watch the domain word order carefully, as reversing the service and namespace parts is a common trap.
Question 41 of 597Your cluster is running at maximum capacity, and you cannot provision additional nodes. You need to update a Deployment named 'order-service' that currently has 10 replicas. The update must ensure that at no point there are more than 10 pods running, and at least 8 pods must be available at all times during the rolling update. Which strategy parameters should you set?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set maxSurge to 0 and maxUnavailable to 2 in the RollingUpdate strategy specification.
Setting maxSurge to 0 prevents any new pods beyond the desired count, while maxUnavailable to 2 maintains the minimum required availability. Choosing a non-zero maxSurge would violate the hard cluster capacity limit.
Question 42 of 597You are managing a microservice that processes messages from a RabbitMQ queue. You notice that occasionally the application enters a deadlock state where the HTTP health check endpoint still responds with 200 OK, but the internal message consumer thread has stopped working entirely. To improve observability and self-healing, you need to implement a check that verifies if the message consumer is still active by checking the timestamp of the last processed message in a local file. How should you configure the Pod to handle this specific failure mode?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure an 'livenessProbe' that uses an 'exec' command to run a script checking the age of the last processed message file.
A liveness probe using an exec command directly checks internal application health and triggers a restart if the script fails. A readiness probe would only stop traffic routing, leaving the deadlocked consumer unhealed.
Question 43 of 597A security-sensitive application requires access to an API key stored in a Kubernetes Secret named 'provider-credentials'. The application is designed to look for this key at a specific file path: '/var/secrets/api/token'. However, the Secret contains multiple data keys (username, password, and token). You need to mount only the 'token' value from the Secret into the container at the exact file path required by the application without mounting the other keys. How should you configure the volumeMounts and volumes in the Pod specification?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use the secret volume with the 'items' field to map the specific key to a path
Using the items field in a secret volume projection selectively exposes specific keys at designated file paths. Environment variables cannot easily map to required file paths, and mounting the entire secret overwrites the directory.
Question 44 of 597A data processing application needs to run a specific maintenance script every night at 2:00 AM. The script performs a cleanup of a shared persistent volume and then terminates. The operation must be guaranteed to run to completion at least once, and if the container fails during the execution, it should be retried until successful. Which Kubernetes resource is specifically designed to handle this time-based, finite task while ensuring completion?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. A CronJob resource that defines the schedule and contains a Job template for the maintenance task.
A CronJob schedules time-based tasks and wraps them in a Job template to ensure finite execution with retries. Deployments are for perpetual services, while StatefulSets and DaemonSets do not guarantee task completion.
Question 45 of 597During a routine update of the 'order-api' deployment, a new container image version (v2.5) was rolled out. Immediately after the update, the support team reported a 100% error rate on the order submission endpoint. You checked the rollout history and found that version 2.4 was the previous stable release. You need to immediately revert the deployment to the state it was in during revision 12, which corresponds to the stable v2.4 version. Which command should you use to perform this specific rollback?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. kubectl rollout undo deployment order-api --to-revision=12
The kubectl rollout undo command with the to-revision flag immediately restores a deployment to its exact previous state. The pause command simply halts a rollout, and set image pushes a new update forward.
Question 46 of 597A critical Java-based microservice takes a significant amount of time to warm up its internal cache after the process starts. During this warm-up period, the application process is running, but it cannot yet handle incoming traffic efficiently and would return errors if it received requests. You need to ensure that the Kubernetes Service does not forward traffic to the Pod until the cache is fully populated. Which probe configuration is most appropriate for this specific requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. A readinessProbe configured to check the cache status via an exec command
A readiness probe checks if an application is ready to accept traffic and removes the pod from endpoints until it passes. A liveness probe restarts unhealthy containers, and a startup probe only gates other probes during initialization.
Question 47 of 597An application pod needs to read and write data to a PersistentVolume (PV) mounted at /data/storage. The application runs inside the container as a non-privileged user with UID 1005. However, the external storage provider provisions the volume with root ownership, causing 'Permission Denied' errors when the application attempts to create files. How can you ensure the application has the correct permissions without modifying the container image or using a root-based sidecar?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure the Pod's securityContext with the fsGroup field set to 1005 to allow the volume to be owned by that group
Setting fsGroup in the pod securityContext automatically changes the mounted volume ownership to the specified group. Running privileged containers or using hostPath volumes violates basic security best practices.
Question 48 of 597A multi-tier application consists of a 'frontend' and a 'database' in the same namespace. To improve security, you must implement a policy that prevents all incoming traffic to the 'database' Pod except for connections on port 5432 originating from Pods that have the label 'role: backend'. Which Kubernetes resource and configuration will achieve this isolation?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. A NetworkPolicy with an ingress rule that selects the backend pods and specifies the target port for the database pods.
A NetworkPolicy applied to the database pods uses an ingress rule to explicitly allow traffic only from pods matching the backend label on port 5432. Services and Ingress resources handle traffic routing and discovery but do not block unauthorized pod-to-pod traffic.
Question 49 of 597An API microservice depends on an external legacy database hosted on-premises. If the database becomes unreachable, the microservice can no longer process requests, but the container process itself remains healthy. The operations team wants to ensure that the Pod stops receiving traffic if the database connection fails, but they do not want Kubernetes to restart the container, as the issue is external and a restart won't fix it. How should the probes be configured?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure a Readiness probe to check database connectivity while keeping the Liveness probe focused only on the local process health.
Failing a Readiness probe removes the Pod from Service endpoints without restarting the container, fulfilling the requirement to stop traffic during an external database outage. A Liveness probe failure would force a restart, which is the exact behavior to avoid here.
Question 50 of 597A web platform needs to host three different services (Marketing, Sales, and Support) under a single external IP address. The routing must be handled based on the URL path: '/marketing' should go to the marketing-service, '/sales' to the sales-service, and '/support' to the support-service. All services are running on port 80. What is the most efficient Kubernetes resource to implement this path-based routing at the cluster edge?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. An Ingress resource with a set of rules defining path-based backend targets for each service.
An Ingress resource configured with path-based routing rules maps distinct HTTP paths to different backend Services behind a single IP. ClusterIP services lack Layer 7 routing capabilities, and custom sidecars introduce unnecessary operational complexity.
Question 51 of 597A financial services company is deploying a highly sensitive payment processing application. The application requires access to an API key and a database password. For security reasons, the security team mandates that these sensitive credentials must never be stored in the Pod's environment variables to prevent accidental exposure via debugging tools. Instead, they must be projected into the Pod as files with restricted permissions. What is the most secure and native way to achieve this requirement in Kubernetes?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Store the credentials in a Kubernetes Secret and mount that Secret as a volume at a specific path in the container.
The correct answer uses a Kubernetes Secret mounted as a volume to project credentials as files. ConfigMaps lack security features for sensitive data, and environment variables risk exposure via logs.
Question 52 of 597A microservice requires a sensitive configuration file to be fetched from a secure vault and placed into a shared volume before the main application starts. The main application does not have the credentials or logic to interact with the vault directly. Which Kubernetes feature allows you to perform this setup securely and ensures the main container only starts once the file is present?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Implement an init container that fetches the file and writes it to an emptyDir volume
Init containers run to completion before any app containers start, guaranteeing the file exists. A postStart hook executes concurrently with the main container, creating a race condition where the app might look for the file before it is written.
Question 53 of 597An application pod requires a specific configuration file to be generated based on the current environment's dynamic variables before the main application starts. This generation process involves running a specialized utility tool that is not included in the main application's lightweight container image to keep the image size small. The generated file should be stored in a location where the main application can read it at runtime. What is the most efficient Kubernetes pattern to implement this?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Use an init container with the utility tool image and a shared emptyDir volume to generate and pass the file to the main container
Init containers run to completion before the main app starts, safely using separate images. A sidecar runs concurrently and wastes resources, while modifying the main image bloats it.
Question 54 of 597An application requires sensitive API keys and a large configuration file to operate. The developer decides to use a Secret for the keys and a ConfigMap for the configuration file, both mounted as volumes. During a maintenance window, the ConfigMap is updated with new values. The developer needs to ensure the application picks up these changes without manually deleting the Pods, assuming the application process is capable of reloading files from disk. Which behavior of Kubernetes volume mounting should the developer rely on?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. The kubelet periodically synchronizes mounted ConfigMaps and Secrets, updating the projected files in the volume without a restart.
The kubelet automatically synchronizes mounted volumes on a configurable delay, updating files without a restart. Avoid using subPath for files that require updates, as subPath mounts do not receive live updates.
Question 55 of 597Your application needs to perform a complex calculation using a large static dataset provided as a CSV file. This dataset is updated weekly by a separate data science team and stored in a ConfigMap named 'calculation-data'. The application expects this data to be available at '/data/values.csv'. However, the application process does not have permission to write to the '/data' directory. How can you ensure the ConfigMap is correctly mounted as a file without changing the directory permissions or the container image?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Mount the ConfigMap using a volumeMount with a subPath that points specifically to the 'values.csv' key within the directory.
Using subPath mounts a specific file without overwriting the target directory. This avoids permission issues entirely. Setting readOnly to false does not bypass filesystem permission rules for the directory.
Question 56 of 597An application Pod named 'batch-processor' has entered a 'CrashLoopBackOff' state immediately after deployment. You have attempted to check the logs using 'kubectl logs batch-processor', but the output is completely empty because the container crashes before it can write anything to the standard output. You need to gather more information about why the container is failing to start or why it is being terminated by the system. Which sequence of commands provides the most relevant diagnostic information for this scenario?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. kubectl describe pod batch-processor and then kubectl logs --previous
The describe command reveals events like failed probes or pull errors. The previous flag retrieves logs from the last crashed instance. Executing into the container will fail because it keeps crashing.
Question 57 of 597You are configuring an Ingress resource to route traffic to multiple microservices. The external users access the services via a single domain 'api.example.com'. Requests to 'api.example.com/orders' should be routed to the 'orders-service' on port 80. However, the 'orders-service' application is not aware of the '/orders' prefix and expects all incoming requests to be on the root path '/'. Which Ingress controller configuration is required to ensure the prefix is removed before the request reaches the backend service?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Add an annotation such as 'nginx.ingress.kubernetes.io/rewrite-target: /' to the Ingress resource to modify the URI path
Ingress controllers use annotations like rewrite-target to modify HTTP requests before forwarding them. Services and NetworkPolicies operate below the application layer and cannot manipulate HTTP paths.
Question 58 of 597A production deployment named 'inventory-api' currently runs 10 replicas of version v1. The management requires that during the update to version v2, the application must never drop below 100% of its current capacity to ensure zero performance degradation for users. Simultaneously, the cloud infrastructure team has set a strict limit on resource usage, allowing only 2 additional Pod instances to be created temporarily during the rollout. Which configuration for the RollingUpdate strategy should you apply to the Deployment manifest?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set maxSurge to 2 and maxUnavailable to 0 to maintain full capacity
Setting maxUnavailable to zero maintains the ten replicas, satisfying full capacity. Setting maxSurge to two respects the strict limit of two extra pods. Any maxUnavailable value above zero drops capacity.
Question 59 of 597Your organization is hosting a web application that must be accessible over HTTPS via the domain 'app.example.com'. You have been provided with a TLS certificate and a private key. You have already created a Kubernetes Secret named 'app-tls-secret' containing the 'tls.crt' and 'tls.key'. You now need to configure an Ingress resource to use this secret for TLS termination at the Ingress controller level. Which section must be added to the Ingress manifest to correctly implement this?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. A tls block containing the hosts list and the secretName referencing the secret
The spec dot tls block configures TLS termination by mapping domain hosts to a specific Kubernetes Secret. The Ingress controller serves the certificate, so backend services can remain on standard HTTP.
Question 60 of 597Your engineering team is deploying a modern application that outputs performance metrics in Prometheus format. However, the organization's legacy centralized monitoring server only accepts metrics via a proprietary XML-based API. You need to implement a solution where a container within the same Pod reads the Prometheus metrics from the application and transforms them into the proprietary format before pushing them to the monitoring server without modifying the original application code. Which container pattern is most appropriate for this specific integration scenario?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Utilize an Adapter container to standardize the output of the application to match the requirements of the external monitoring system.
The Adapter pattern standardizes output by transforming internal application data for external systems. This differs from a standard sidecar, which typically extends or proxies services without fundamentally altering the data format.
Question 61 of 597A critical banking application requires a deployment strategy where the new version (v2) is fully deployed and tested alongside the current version (v1) before any production traffic is cut over. The organization requires a method that allows for an instantaneous switch of traffic and an immediate rollback by pointing back to the old version if any issues are detected in the live environment. Which Kubernetes-native approach best meets these requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Deploy version v2 as a separate Deployment and update the Service label selector to point to the new version's labels.
Updating a service selector to point to a completely new deployment achieves a Blue-Green release. Rolling updates lack instantaneous rollback because traffic must be gradually shifted back to the original pods.
Question 62 of 597A DevOps engineer is troubleshooting a 'payments-api' deployment that keeps failing with a status of OOMKilled. The node has plenty of available memory, but the Pod specifically is being terminated shortly after it starts processing transactions. The developer suspects that the resource constraints defined in the deployment manifest are too restrictive for the application's actual memory footprint during peak loads. Which action is the most appropriate to stabilize the deployment?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Increase the memory limit in the resources section of the container specification to match the application's peak usage requirements.
The OOMKilled status indicates a container exceeded its configured memory limit. Increasing the limit in the resource specification directly resolves the termination. Moving the pod to a larger node will not help because the kernel kills the process based on the pod limit, not node capacity.
Question 63 of 597You are tasked with securing a public-facing web application hosted on Kubernetes. The application is accessed via an Ingress resource at the host 'api.company-services.com'. Your security department has provided a valid SSL certificate and a private key that must be used to encrypt all incoming traffic. You have already created a TLS secret named 'api-tls-secret' in the same namespace as the application. How must the Ingress resource be configured to correctly utilize this secret for HTTPS termination for the specified host?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Add a tls section to the Ingress spec containing the secretName and the list of hosts
The standard method for enabling TLS on an Ingress is adding a tls section to the spec with the secretName and hosts list. Controller-specific annotations are deprecated and non-portable. Relying on the native tls block ensures the controller correctly serves the certificate for the specified hostname.
Question 64 of 597A developer is troubleshooting a deployment named 'order-service' that is constantly crashing immediately after start. The 'kubectl get pods' command shows the status as 'CrashLoopBackOff'. The developer needs to see the log output from the very last execution of the container to understand why it failed, but the logs for the currently running (but failing) container are empty. Which command provides the necessary diagnostic information?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Execute 'kubectl logs order-service --previous' to retrieve the logs from the last terminated container instance
The --previous flag retrieves stdout and stderr from the previously terminated container instance. This is the primary debugging tool for CrashLoopBackOff scenarios where the current container has not logged anything yet. The describe command only shows cluster events, not application output.
Question 65 of 597During a troubleshooting session, you notice that several Pods for your application are stuck in the 'ImagePullBackOff' state. You suspect that the issue is related to the private container registry credentials, but you need to confirm exactly why the image retrieval is failing (e.g., 'authentication failed' vs 'image not found'). Which 'kubectl' command provides the detailed event log showing the specific error messages from the Kubelet regarding the image pull process?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. kubectl describe pod <pod-name> to inspect the 'Events' section at the bottom of the output.
The kubectl describe pod command displays a chronological Events section containing explicit Kubelet messages detailing exactly why the image pull failed. The logs command will not work because the container has not started, meaning there is no application output to inspect.
Question 66 of 597An enterprise legacy application is migrating to a Kubernetes environment. The application is hardcoded to write its internal transaction logs to a specific local file path within its container. To comply with the company's centralized logging policy, you must ensure these logs are continuously streamed to a logging aggregator without altering the application's source code or its container image. You decide to implement a multi-container Pod. Which container pattern is most appropriate to solve this requirement by sharing a volume and tailing the log file?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Implementing a Sidecar container that shares an emptyDir volume with the main application and tails the log file to stdout.
A sidecar container shares an emptyDir volume with the main application to read and stream logs to stdout. This decouples logging from the primary application and allows standard Kubernetes logging to capture the output. An init container cannot continuously run to stream logs.
Question 67 of 597A mission-critical financial application Pod is consistently being terminated with an 'OOMKilled' status. You have observed that while the container usually stays under 256Mi of RAM, it occasionally spikes to 1Gi during daily reconciliation tasks. The namespace currently has a LimitRange that enforces a maximum memory limit of 512Mi for all containers. What is the most effective way to allow the Pod to handle these spikes while ensuring it doesn't consume all cluster resources?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Update the Pod's container spec to set a memory 'limit' of 1Gi and ensure the namespace LimitRange is adjusted to allow this value.
The container memory limit must be raised above the spike threshold to prevent the kernel from killing the process. Because a LimitRange enforces maximum values, it must also be updated to permit the new 1Gi limit. Increasing requests without limits does not prevent termination.
Question 68 of 597Your organization is implementing strict security controls for a three-tier application consisting of a frontend, a backend, and a database. The security policy dictates that the 'backend' pods in the 'prod' namespace should only accept incoming traffic from 'frontend' pods on port 8080 and must be prohibited from communicating with any external internet resources. Which NetworkPolicy configuration must be applied to the 'backend' pods to enforce these specific constraints?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Apply an Ingress policy allowing the frontend label and a separate Egress policy with an empty set of allowed destinations.
Applying an Ingress rule with a podSelector for the frontend allows specific incoming traffic, while an empty Egress rule blocks all outgoing traffic. Using a CIDR block filter is imprecise for dynamic pod IPs, and HostPort bypasses standard network policy enforcement entirely.
Question 69 of 597An enterprise application generates operational metrics in a proprietary XML format through a local Unix socket. The organization has standardized on Prometheus for monitoring, which requires metrics to be exposed via HTTP in a specific plain-text format. You are tasked with implementing a solution that allows the central monitoring system to scrape these metrics without modifying the legacy application code. The solution must ensure that the transformation logic is decoupled from the main application logic and runs within the same network namespace to access the local socket efficiently.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Deploy an Adapter container within the same Pod that consumes the XML metrics and exposes them on a dedicated HTTP port for Prometheus
An adapter container standardizes output by transforming proprietary application metrics into a format the monitoring system expects. Running in the same pod allows it to access the local socket efficiently. An ambassador container proxies traffic, while an init container cannot run continuously.
Question 70 of 597Your team is preparing to deploy a mission-critical update to a financial API. The management requires a deployment strategy where the new version is fully deployed and tested in the production environment before any live traffic is switched. If the new version fails validation, the switch must be reverted instantly. Which approach best satisfies these constraints in a Kubernetes environment?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Deploy a second Deployment for the new version and update the Service selector to point to the new version labels after successful validation.
Deploying a second deployment and updating the service selector implements a blue-green strategy, providing instant traffic shifting and rollback. A rolling update gradually replaces old pods, meaning both versions receive live traffic simultaneously and rollback is not instantaneous.
Question 71 of 597A security audit reveals that several Pods in the 'finance' namespace are running with root privileges, which violates the company's security policy. The developer must update the Deployment manifest to ensure that the container runs as a non-privileged user (UID 1000) and cannot escalate its privileges or access the host's sensitive files. Which section of the Pod specification should be modified to enforce these security constraints?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set the securityContext at the container level with runAsUser: 1000 and allowPrivilegeEscalation: false.
Setting the container-level securityContext with runAsUser: 1000 and allowPrivilegeEscalation: false directly enforces the required non-root and non-escalating execution. RoleBindings and ResourceQuotas manage API access and resource limits, not the running container's process privileges.
Question 72 of 597A specialized database container requires a specific configuration script to be executed immediately after the container process starts. This script registers the container's IP in a legacy registry system. The script must run within the same container environment as the database engine, but the database engine itself does not have a mechanism to trigger external scripts. Which Kubernetes feature should be used?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. A postStart lifecycle hook that executes the registration script once the container has been created.
The postStart hook executes immediately after the container is created, making it perfect for registering the IP. An InitContainer is incorrect because it runs and terminates before the main container starts.
Question 73 of 597Your company is deploying a complex web application architecture where different services need to be accessible via a single public IP address. The requirements specify that requests to 'api.company.com/v1' should be routed to the 'v1-service' on port 80, and requests to 'api.company.com/v2' should be routed to the 'v2-service' on port 8080. Both services are in the same namespace. Which Kubernetes resource is best suited to manage this traffic routing based on the URL path?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. An Ingress resource with rules defining a single host and multiple paths, each pointing to a different backend service
An Ingress resource is the standard choice for Layer 7 load balancing, natively supporting path-based routing for splitting traffic between services. NetworkPolicies are incorrect because they manage IP-level firewall rules, not HTTP request routing.
Question 74 of 597You are deploying a distributed database where each instance must be addressable individually by a stable DNS name to manage peer-to-peer synchronization. The instances manage their own replication and need to know the direct IP addresses of their peers. Standard Service load balancing is not desired because the application logic handles traffic distribution among the members.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Create a Headless Service by setting the clusterIP field to None in the specification
Setting clusterIP to None creates a Headless Service, which returns individual pod IP addresses via DNS instead of a single virtual IP. This enables direct peer-to-peer communication required by stateful applications. NodePort or Ingress add unwanted load balancing.
Question 75 of 597A monolithic legacy application is being containerized and deployed into a production cluster. During its startup phase, the application performs a heavy checksum validation of its local data files, which typically takes 180 seconds to complete. The current LivenessProbe is configured to check the health endpoint every 10 seconds. However, because the application is fully occupied with the checksum process, it cannot respond to the probe, leading the Kubelet to restart the container repeatedly before it ever reaches a ready state. Which configuration should be implemented to resolve this cycle?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Implement a StartupProbe with a failureThreshold of 30 and a periodSeconds of 10 to disable other probes during initialization
A StartupProbe disables Liveness and Readiness probes until it succeeds, preventing slow containers from being killed by the Kubelet during initialization. Relying on initialDelaySeconds is brittle because exact startup times fluctuate under variable loads or hardware conditions.
Question 76 of 597A financial data processing application uses a CronJob to run a reconciliation script every minute. The script typically completes in 45 seconds, but during peak hours, it can take up to 150 seconds. The operations team notices that multiple instances of the same Job are running simultaneously, causing race conditions and database locks that corrupt the reconciliation data. You need to ensure that if a new Job is scheduled while the previous one is still active, the new execution is skipped entirely to protect data integrity. Which configuration parameter in the CronJob spec will achieve this behavior?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set the concurrencyPolicy field to Forbid within the CronJob specification
Setting concurrencyPolicy to Forbid tells the controller to skip creating new Jobs if an existing one is still running. The Replace policy kills the active Job, while changing history limits only cleans up old completed tasks without preventing overlaps.
Question 77 of 597A web application experiences highly variable traffic patterns throughout the day. To ensure high availability and cost-efficiency, the operations team wants the number of running pods to automatically increase when the average CPU utilization across all pods exceeds 70%, and decrease when the load drops. The application is managed by a Deployment. Which Kubernetes component must be configured to enable this dynamic scaling behavior?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. A Horizontal Pod Autoscaler (HPA) targeting the Deployment with the specified CPU utilization threshold
The Horizontal Pod Autoscaler automatically scales the number of Deployment replicas based on observed CPU utilization. The Cluster Autoscaler only adjusts the cluster node size, and the Vertical Pod Autoscaler modifies resource requests rather than replica counts.
Question 78 of 597A production team is managing a high-traffic web service currently running on Deployment 'webapp-v1'. They need to perform a zero-downtime update to 'webapp-v2'. The requirement is to maintain 100% of the current capacity at all times during the update process to prevent performance degradation. However, the cluster has limited extra resources, so they can only afford to run 25% additional capacity during the transition. Which configuration of the RollingUpdate strategy in the Deployment manifest correctly addresses these infrastructure constraints and capacity requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Define maxUnavailable as 0% and maxSurge as 25% to ensure no capacity is lost while limiting the temporary resource overhead
Setting maxUnavailable to 0 guarantees no existing pods are removed before new ones are ready. Pairing it with a 25% maxSurge strictly limits the temporary extra pods, satisfying the resource constraint while maintaining full application availability.
Question 79 of 597Your development team has provided a ConfigMap named 'app-config' that contains over 40 individual environment variables required by a microservice. Instead of mapping each variable individually in the Deployment manifest using the 'valueFrom' field, you want to inject all the keys in the ConfigMap as environment variables into the container automatically. This approach should ensure that any new keys added to the ConfigMap in the future are automatically included in the next Pod deployment without manifest changes. Which field in the container spec allows this bulk injection?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use the envFrom field and reference the ConfigMap using the configMapRef attribute
The envFrom field automatically imports all key-value pairs from a ConfigMap as container environment variables. This avoids listing each variable individually with valueFrom and ensures future ConfigMap additions are automatically consumed by the container.
Question 80 of 597A financial reconciliation task is scheduled to run every 5 minutes using a Kubernetes CronJob. Due to occasional high data volumes, the task sometimes takes 7 or 8 minutes to complete. The business requirement states that if a previous execution is still running when the next scheduled interval arrives, the new execution must not start, to avoid data corruption and resource contention. Which setting in the CronJob specification ensures this behavior is strictly enforced by the controller?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure concurrencyPolicy to 'Forbid' to prevent the controller from creating a new Job if the previous one has not finished
The Forbid policy explicitly tells the CronJob controller to skip creating a new Job if an existing one is still running. Replace terminates the current Job, and backoffLimit only dictates retry behavior for failed tasks rather than concurrency rules.
Question 81 of 597A security policy requires that the 'frontend' pods in the 'production' namespace must only be allowed to communicate with 'backend' pods on port 8080. All other outgoing traffic from the 'frontend' pods, including traffic to external internet addresses or other internal pods, must be blocked. Which NetworkPolicy configuration achieves this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Create an Egress policy for 'frontend' pods with a 'to' rule selecting 'backend' pods and a 'ports' rule for 8080.
An Egress policy applied to the frontend pods explicitly restricts outgoing traffic to only the specified backend on port 8080. An Ingress policy on the backend fails this requirement because it does not block the frontend from sending traffic to external addresses.
Question 82 of 597A healthcare technology company is deploying a HIPAA-compliant web service in a Kubernetes cluster. The application, named 'portal-app', must be accessible over HTTPS using the domain 'portal.healthcare.com'. The infrastructure team has provided a TLS certificate and a private key stored in a Kubernetes Secret named 'portal-tls-secret' within the 'production' namespace. To meet compliance standards, you need to configure an Ingress resource that terminates TLS using this specific secret and routes incoming traffic from 'portal.healthcare.com' to a service named 'portal-svc' on port 8080. You must ensure the Ingress is configured according to the 'networking.k8s.io/v1' API standards. Which configuration snippet correctly defines the Ingress resource to meet these requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Define the 'tls' field with 'hosts' containing 'portal.healthcare.com' and 'secretName' set to 'portal-tls-secret', while setting the 'rules' to forward traffic to 'portal-svc' on port 8080.
The tls block in the Ingress specification correctly associates the TLS secret with the host, while the rules block maps the host to the backend service port. ConfigMaps cannot store TLS keys, and annotations alone fail to configure secure routing properly.
Question 83 of 597You are performing a canary release for a new version of a stateless web service. The current version is running in a Deployment named 'webapp-v1' with 9 replicas. You have created a new Deployment named 'webapp-v2' with 1 replica. Both deployments share the same label 'app: webapp-service'. A single Service is configured with the selector 'app: webapp-service'. How will Kubernetes distribute incoming traffic to these pods?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Traffic will be distributed randomly among all 10 available pods, resulting in approximately 10% of traffic reaching the new 'webapp-v2' version.
The Service load balances randomly across all matching pods, sending roughly 10% of traffic to the new version. Kubernetes does not understand version labels natively, so it treats all matching pods as identical endpoints rather than isolating deployments.
Question 84 of 597A developer wants to deploy a container that needs to capture network packets for debugging purposes within a specific namespace. For security reasons, you must grant the minimum necessary Linux capabilities rather than running the container in privileged mode. Which configuration in the Pod's securityContext will allow the container to perform packet capture while maintaining security?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Add the NET_RAW capability to the capabilities list in the security context
The NET_RAW capability allows processes to use raw and packet sockets, which tools like tcpdump need for capturing traffic without full host access. Setting privileged to true violates the least-privilege principle, and root permissions do not directly grant specific capabilities securely.
Question 85 of 597You are tasked with deploying a new version of a stateless web application. The business requirement is to ensure that the transition happens with zero downtime. During the update, the cluster should always have at least the current number of desired replicas running, and it is acceptable to temporarily exceed the desired replica count to speed up the rollout. Which strategy and parameters should be configured in the Deployment manifest to satisfy these constraints?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set the strategy type to RollingUpdate with maxUnavailable set to 0 and maxSurge set to 25%.
Setting maxUnavailable to 0 ensures no pods are removed until new ones are ready, maintaining full capacity. Setting maxSurge allows the deployment to create additional pods during the update, fulfilling the requirement to speed up the rollout.
Question 86 of 597Your organization has a strict security policy requiring that all containers in the 'payment-gateway' namespace run as non-root users. You are deploying a new microservice that needs to run with the specific user ID 2000 and group ID 3000. These settings must be enforced for all containers within the Pod. Where should you define these requirements in the manifest?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Apply the runAsUser and runAsGroup settings within the securityContext section at the Pod level of the manifest.
Defining runAsUser and runAsGroup in the pod-level securityContext ensures all containers inherit these exact execution permissions. Applying settings at the container level only affects one container, and service accounts handle API authentication.
Question 87 of 597A developer needs to deploy an Nginx container that uses a custom 'nginx.conf' file stored in a ConfigMap named 'web-config'. The Nginx image stores its default configuration files in the '/etc/nginx' directory. If the developer mounts the ConfigMap directly to '/etc/nginx', all existing files in that directory (like mime.types) will be hidden. The requirement is to inject only the 'nginx.conf' file into the existing '/etc/nginx' directory without losing the other files provided by the container image.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use the 'subPath' field in the volumeMounts section to mount only the specific 'nginx.conf' key from the volume into the full file path
Using the subPath field in volumeMounts injects a single ConfigMap file into an existing directory without overwriting neighbors. Without subPath, the entire directory is masked by the mounted volume, breaking the container.
Question 88 of 597You are deploying an Ingress resource to manage traffic for a multi-tenant platform. The platform hosts two separate services: 'billing.example.com' and 'support.example.com'. The billing service requires HTTPS and uses a TLS certificate stored in a Secret named 'billing-tls-cert'. The support service currently only requires HTTP. How should the Ingress manifest be structured to provide TLS for the billing host only while routing traffic to both services correctly?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Define a single Ingress with a 'tls' block where the 'hosts' list only includes 'billing.example.com' and the 'secretName' is 'billing-tls-cert'.
Creating a single Ingress with a TLS block for the billing host correctly restricts HTTPS to that domain. However, creating two separate Ingress resources is also valid, making the options ambiguous.
Question 89 of 597An organization hosts two separate web services: 'shop.example.com' and 'blog.example.com'. Both services are running in the same Kubernetes cluster. You need to configure a single entry point that routes traffic to the correct service based on the Host header in the HTTP request and handles SSL termination at the entry point.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Implement an Ingress resource with rules defined for each host pointing to their services
An Ingress resource manages external access to services, providing Layer 7 routing and TLS termination. Services lack host-based routing, making Ingress the only option for HTTP host rules.
Question 90 of 597An enterprise microservice is being migrated to a Kubernetes cluster. The application was originally designed to connect to a local database on a specific port. Due to architectural constraints, the application cannot be modified to handle complex connection logic or service discovery for the external sharded database it now needs to access. You decide to implement a specialized container within the same Pod that acts as a local proxy, intercepting the application's requests and routing them to the appropriate database shard. Which architectural pattern are you implementing to solve this connectivity requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Deploying an Ambassador container to proxy the database connections
The Ambassador pattern deploys a proxy container to handle outbound traffic on behalf of the main application. This abstracts complex service discovery or sharding logic away from the application code.
Question 91 of 597An enterprise is hosting multiple web services under the same domain but different subpaths: '/api' routes to the 'api-service' and '/static' routes to the 'content-service'. They need to implement an Ingress resource that handles this routing and also terminates SSL/TLS using a certificate stored in a Secret named 'tls-secret'. How should the Ingress rules be structured to achieve this path-based routing securely?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Define a single host with multiple paths in the 'rules' section and specify the 'tls' section referencing the 'tls-secret'.
A single Ingress resource can define multiple paths under a specific host block and configure TLS termination. Using NodePort or separate Ingress resources lacks native path mapping and unified TLS management.
Question 92 of 597Startup Probes for Legacy Apps. A legacy Java application takes a significant amount of time to initialize, often between 3 and 5 minutes, due to heavy JVM startup and database schema validations. During this period, the application does not respond to any traffic. The operations team has noticed that the Liveness probe often fails during this startup phase, causing the container to restart in an infinite loop. They need a solution that prevents the Liveness and Readiness probes from interfering until the application is fully initialized, without increasing the failure thresholds of those probes permanently.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Implement a Startup probe with a failureThreshold of 30 and a periodSeconds of 10 to protect the container during its initial boot
A Startup probe specifically disables Liveness and Readiness checks until it succeeds, accommodating slow-starting applications. Modifying initialDelaySeconds forces rigid timing limits that cannot adapt.
Question 93 of 597Egress Network Policies. An application Pod named 'data-fetcher' in the 'processing' namespace needs to communicate with an external API service located at the static IP address 203.0.113.10. For compliance reasons, the security team has requested a NetworkPolicy that blocks all outgoing traffic from this Pod to any other internal or external destination, except for this specific API IP and the internal DNS service (kube-dns) on port 53. Which NetworkPolicy configuration correctly implements this restrictive egress rule?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. An Egress policy with two rules: one with an ipBlock allowing 203.0.113.10/32, and another allowing UDP/TCP port 53 to the kube-system namespace
Defining an Egress policy triggers default-deny behavior for all unspecified outbound traffic. You must explicitly allow an ipBlock for the external API and a namespace selector for DNS resolution.
Question 94 of 597An application Pod in the 'security-tools' namespace needs to interact with the Kubernetes API to list other Pods and their IP addresses for a network mapping utility. By default, the Pod is using the 'default' ServiceAccount, which does not have the necessary permissions to query the API. You have already created a Role and a RoleBinding that grant the 'list' permission on Pod resources. What is the final step required in the Pod manifest to ensure the application can successfully authenticate and use these permissions?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Specify the custom 'serviceAccountName' in the Pod's spec section
A Pod inherits permissions based on its explicitly assigned serviceAccountName, mounting the correct API token. Without mapping the specific ServiceAccount, the default restricted permissions remain active.
Question 95 of 597An analytics team needs to run a data processing task that takes several hours to complete. The task consists of 10 independent units of work. To optimize time, they want to process 3 units simultaneously. The task must be resilient; if a specific unit fails, it should be retried until it succeeds. Which Kubernetes object and configuration parameters should be used to manage this batch processing requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. A Job with completions: 10 and parallelism: 3 to ensure sequential completion with a set amount of concurrent workers.
A Kubernetes Job is designed for finite tasks and automatically retries failed pods until they succeed. Setting parallelism limits concurrent workers, optimizing resource usage while completions tracks the total required successes. CronJobs are for scheduled recurring tasks.
Question 96 of 597A data processing task must run to completion exactly once for each data set provided. If the pod performing the task fails due to a node crash, Kubernetes must ensure a new pod is scheduled to complete the remaining work. The task is not continuous and should stop once the processing logic returns a success code.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Deploy a Job with a restartPolicy set to OnFailure to ensure task completion
A Job handles run-to-completion workloads. Setting restartPolicy: OnFailure guarantees that Kubernetes retries the container exactly until it succeeds. A Deployment or DaemonSet is incorrect because they manage continuous, long-running processes.
Question 97 of 597You are managing a production deployment of a web application that frequently experiences internal deadlocks. When a deadlock occurs, the main process continues to run, so the container remains in a 'Running' state, but the application stops responding to all incoming requests. To ensure high availability, you need to configure a mechanism that automatically detects this non-responsive state and restarts the faulty container. Which Kubernetes probe configuration should you implement to address this specific failure mode?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Define a LivenessProbe with an HTTP GET action targeting a health check endpoint that verifies internal application logic.
A LivenessProbe with an HTTP GET action checks application health and restarts the container upon failure. TCP socket checks only verify network listening, failing to detect internal application deadlocks.
Question 98 of 597Sidecar for Metrics Transformation. You are deploying a microservice that exposes raw performance data via a local text file updated every 30 seconds. You need to use a sidecar container to read this file and provide an HTTP endpoint that a central monitoring tool can query. The two containers must share a common storage area to exchange the file. Which volume type is most appropriate for this high-frequency, transient data exchange between two containers within the same Pod?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. An emptyDir volume mounted at the same path in both containers to provide a shared, temporary filesystem in memory or on disk
An emptyDir volume provides shared, temporary storage accessible by all containers within a single Pod. Persistent volumes are unnecessary for transient data, and ConfigMaps are strictly read-only.
Question 99 of 597A legacy internal application only supports HTTP communication, but the security team mandates HTTPS for all traffic entering the pod. The development team decides to use an Nginx sidecar container to handle SSL/TLS termination so the application code remains unchanged. The sidecar needs to listen on port 443 and proxy traffic to the application on port 8080. Which configuration detail is essential for this sidecar pattern to function correctly within the same Pod?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure the Nginx sidecar and application container to share the same Network namespace using localhost for communication.
Containers within the same Pod inherently share the same Network namespace, enabling them to communicate via localhost. The proxy sidecar listens on external ports while forwarding traffic to localhost.
Question 100 of 597A development team is struggling with a Pod containing two containers: an 'app-container' and a 'helper-container'. The 'helper-container' crashes frequently during the first 10 seconds of startup due to a configuration error. When the team tries to view the logs using 'kubectl logs helper-container', they only see logs from the newly restarted instance which doesn't show the initial error. What command should be used to inspect the logs of the instance that crashed immediately prior to the current one?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Run 'kubectl logs pod-name -c helper-container --previous' to retrieve the logs from the last terminated container instance.
The --previous flag retrieves logs from the last terminated instance of a container, essential for debugging crash loops. Events and current logs rarely capture the exact application failure trace.
Study on mobile
Get CertPunch for iOS or Android.