Linux Foundation
Certified Kubernetes Application Developer (CKAD)
Question 101 of 597A security-focused financial microservice named audit-logger is being deployed into a hardened Kubernetes namespace. During a recent internal security assessment, the compliance team discovered that the application Pods are automatically mounting the default ServiceAccount credentials at the path /var/run/secrets/kubernetes.io/serviceaccount. Since the audit-logger microservice does not need to interact with the Kubernetes API, this configuration poses an unnecessary security risk of credential leakage if the container is ever compromised. You are tasked with ensuring that no API token is automatically projected into the Pods of this specific deployment while maintaining the standard deployment configuration for other services in the same namespace. Which configuration change is required in the Deployment manifest to meet this security requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set the automountServiceAccountToken field to false within the spec.template.spec section of the Deployment manifest.
Setting automountServiceAccountToken to false within the Pod template spec prevents Kubernetes from injecting the default API token. Overwriting the mount path with an emptyDir is a hacky workaround, whereas the native boolean field is the intended security control.
Question 102 of 597Your main application container generates metrics in a proprietary binary format and writes them to a shared volume at /data/logs/metrics.bin. The company's monitoring system requires these metrics to be available in a Prometheus-compatible text format at a specific /metrics endpoint via HTTP. You need to deploy a solution that performs this conversion in real-time within the same Pod. Which multi-container pattern is most appropriate?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. The Adapter pattern, where a second container transforms the output of the main container into a standardized format for external systems
The Adapter pattern transforms the main container output into a standardized format for external monitoring systems to consume. A generic sidecar merely adds features, while an Ambassador strictly proxies external network traffic.
Question 103 of 597You need to run a high-volume data migration task that involves processing 500 independent datasets. The task is encapsulated in a container image that processes one dataset and then exits. To complete the migration quickly, you want to ensure that 10 containers are running in parallel at any given time until all 500 datasets are processed. If a container fails, the system should attempt to retry it, but the whole task should stop if there are more than 5 total failures.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Create a Job with 'completions: 500', 'parallelism: 10', and 'backoffLimit: 5' to manage the execution and retries.
A Kubernetes Job uses completions to target successful exits and parallelism to control concurrency. The backoffLimit halts the entire workload after the specified failure count, which Deployments cannot do natively.
Question 104 of 597A containerized Node.js application takes a significant amount of time to load its initial configuration and cache into memory, typically between 45 and 60 seconds. If the container is checked for health during this period, it fails the check and is restarted by Kubernetes, leading to an infinite loop of restarts. You need to ensure the container is not killed during its long startup phase while still allowing it to be restarted if it deadlocks later. What is the most efficient configuration?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Implement a startupProbe with a failureThreshold of 30 and a periodSeconds of 5 to allow up to 150 seconds for initialization
A startup probe disables liveness and readiness checks until it succeeds, providing a dedicated window for initialization without affecting long-term monitoring.
Question 105 of 597You are managing a secure web API container that requires custom authentication headers for its health check endpoint. The liveness probe must target the '/healthz' path on port 8443 and include a header named 'X-Internal-Token' with a value retrieved from a Secret. If the probe does not receive a 200 OK response with the correct header, the container should be restarted. How should the livenessProbe be configured in the YAML manifest?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Use an httpGet probe with the path, port, and an httpHeaders array containing the name and value of the token.
An httpGet probe natively supports custom HTTP headers, allowing you to pass authentication tokens directly during health checks. While an exec probe using curl could technically work, it introduces unnecessary operational overhead and relies on external binaries inside the container image.
Question 106 of 597You are updating a critical 'api-gateway' deployment which currently has 10 replicas. To maintain high availability during the update, the business requires that at least 8 replicas remain available at all times. Additionally, to avoid overloading the underlying nodes, no more than 13 replicas should exist in total at any point during the rollout. How should the 'strategy' section of the Deployment be configured?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set maxUnavailable to 2 and maxSurge to 3 within the RollingUpdate strategy block of the Deployment manifest.
Setting maxUnavailable to 2 ensures at least 8 pods remain available during the rollout. Setting maxSurge to 3 guarantees that the total number of pods never exceeds 13, satisfying both high availability and resource constraints.
Question 107 of 597A developer is reporting that their application keeps restarting because the internal cache takes 2 minutes to populate. Currently, the Pod is marked as unhealthy by the liveness probe after 30 seconds, triggering a container kill and restart cycle. You need to ensure the application isn't killed while it's still initializing, but also remains unavailable for traffic until the cache is fully ready.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Configure a startupProbe with a long failureThreshold and a readinessProbe for traffic control
A startupProbe protects slow-starting applications by disabling liveness checks until initialization completes. Coupling it with a readinessProbe ensures the application receives traffic only when fully prepared, preventing premature container restarts.
Question 108 of 597You need to process a queue of 50 work items using a Kubernetes Job. To speed up the process, you want to ensure that exactly 5 Pods are running at any given time until all 50 items are processed successfully. If a Pod fails, it should be replaced, and the Job should only be considered complete once 50 successful completions are recorded.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Set completions to 50 and parallelism to 5 within the Job's spec section
The Kubernetes Job controller natively handles parallel batch processing using the completions and parallelism fields. Setting parallelism to 5 maintains the desired workload concurrency until 50 successful completions are recorded.
Question 109 of 597In a shared development cluster, several teams are deploying applications into the 'sandbox' namespace. Occasionally, a poorly configured application consumes all the available memory on a node, causing the Kubelet to evict critical pods from other teams. You need to implement a policy that ensures every container in the 'sandbox' namespace has a memory limit of 512Mi even if the developer does not specify one in their Pod manifest.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Create a LimitRange object in the 'sandbox' namespace and specify the 'default' memory limit for containers.
A LimitRange is the correct Kubernetes mechanism to enforce default resource limits at the container level. While a ResourceQuota restricts total namespace consumption, it does not automatically inject missing memory limits into individual pod manifests.
Question 110 of 597An engineer is investigating an 'auth-service' deployment stuck in 'CreateContainerConfigError'. The pod is configured to mount a secret named 'api-credentials' as a volume. The engineer suspects the secret might be missing or incorrectly named. What is the most effective command to verify the exact reason for the failure and the state of the secret dependency?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Run 'kubectl describe pod [pod-name]' and check the Events section for mount failures
The kubectl describe pod command outputs a detailed Events section that explicitly states why a container failed to start. You can quickly spot volume mount errors or missing secret dependencies there without needing application logs.
Question 111 of 597A retail application experiences sudden spikes in traffic during holiday sales. You want to implement an automatic scaling mechanism that increases the number of replicas when the average CPU utilization across all pods in the 'orders' deployment exceeds 70%. You also want to ensure that the scaling doesn't happen too rapidly to avoid 'flapping' during minor fluctuations. Which Kubernetes resource should be configured to manage this behavior?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Create a HorizontalPodAutoscaler (HPA) targeting the 'orders' deployment with a targetAverageUtilization of 70 and appropriate stabilization windows.
A HorizontalPodAutoscaler automatically scales the number of pods based on observed CPU utilization. Configuring its behavior field with stabilization windows prevents rapid scaling actions, effectively avoiding flapping during minor metric fluctuations.
Question 112 of 597A web application needs to connect to an external database that requires a complex custom authentication protocol and local caching of query results. To keep the main application code simple and clean, you decide to use a multi-container pod pattern where a secondary container handles the authentication and caching, presenting a simple localhost interface to the main application. Which multi-container pattern is being described here?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. The Ambassador pattern, which acts as a proxy to represent an external service as if it were a local service.
The Ambassador pattern acts as a dedicated proxy to simplify communication with complex external services. The main application connects to this helper container on localhost, entirely abstracting away the custom authentication and caching logic.
Question 113 of 597A web application requires a sensitive database password and a TLS certificate to initialize correctly. These credentials are stored in Kubernetes Secrets named db-pass and site-tls. For security and architectural reasons, the password must be injected as an environment variable called DB_PASSWORD, while the certificate files must be accessible to the application as files in the /etc/tls directory. Which configuration strategy should be implemented?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use secretKeyRef to map the password to an environment variable and define a volume of type secret to mount at /etc/tls
Using secretKeyRef maps a specific secret key directly into an environment variable for the container. Mounting a secret volume separately exposes the certificate files securely into the specified directory without hardcoding sensitive data.
Question 114 of 597Your company is running a mission-critical web application on Kubernetes. During updates, you must ensure that the application never drops below 100% of its desired replica count to handle peak traffic. At the same time, the cluster has limited resource overhead, so you cannot have more than 2 extra Pods running at any given time during the rollout of a new version. You need to configure the 'strategy' field of the Deployment.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Configure a RollingUpdate with maxSurge set to 2 and maxUnavailable set to 0 to maintain full capacity during the update.
Setting maxUnavailable to 0 maintains full capacity, while maxSurge to 2 strictly limits extra pods. Allowing unavailable pods is the strongest distractor, but it breaks the required capacity rule.
Question 115 of 597You are troubleshooting a legacy Java application deployed in the 'production' namespace. The application occasionally enters a 'zombie' state where the process is still running, but the internal HTTP server stops responding to requests due to a localized deadlock. When this happens, the container does not crash, but the application becomes useless. To automate recovery, you decide to implement a probe. The application exposes a health check endpoint at '/healthz' on port 8080. Which probe configuration is most appropriate to ensure the container is automatically restarted when it enters this specific failed state?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Define a Liveness Probe using an httpGet request to port 8080 on the /healthz path.
A liveness probe using HTTP GET accurately restarts containers stuck in deadlock states. A readiness probe is the strongest distractor, but it merely stops traffic instead of restarting.
Question 116 of 597A development team is deploying a Node.js microservice that requires a specific database schema to be present in an external PostgreSQL instance. To ensure the application does not start with an incompatible schema, a migration script must be executed successfully before the main application container begins its execution. If the migration script fails, the entire Pod must stop its startup process and report the failure. Which Kubernetes feature is best suited for this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Utilize an initContainer in the Pod spec to run the database migration script before the main container
An initContainer runs to completion before the main container, blocking startup if it fails. A sidecar is the strongest distractor, but it runs concurrently instead of sequentially.
Question 117 of 597A data analysis team uses a CronJob to run a heavy reconciliation script every hour. Recently, they noticed that if a job takes longer than 60 minutes, a second job starts while the first is still running, leading to database lock contention and corrupted reports. You must ensure that no new job is started if a previous instance is still active, and any missed executions should be ignored.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set the concurrencyPolicy to Forbid in the CronJob specification to prevent overlapping executions.
Setting concurrencyPolicy to Forbid correctly prevents overlapping jobs from running simultaneously. Changing schedule frequency is the strongest distractor, but it fails under delays.
Question 118 of 597A legacy binary is running in a pod and writes its logs to a local file at /var/log/app.log. The cluster's logging infrastructure only collects logs from the standard output (stdout) and standard error (stderr) streams of the containers. You need to ensure these file-based logs are captured by the cluster logging agent without modifying the legacy application code. What is the standard Kubernetes pattern to achieve this?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Add a sidecar container to the Pod that runs a tail -f command on the log file, sharing the log directory via an emptyDir volume.
Adding a sidecar container that streams the log file to stdout makes the logs visible to standard Kubernetes logging tools. Do not use hostPath or persistent volumes, as they bypass container stdout and are not collected by node-level logging agents.
Question 119 of 597You have a ConfigMap named 'global-settings' that contains 50 different configuration keys. You need to deploy a specific Pod that only requires one of these keys, named 'proxy-config.json'. This file must be mounted at the path '/etc/app/proxy-config.json' inside the container. Crucially, other files already existing in the '/etc/app/' directory of the container image must not be hidden or overwritten by the mount. How should this be configured?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use the 'volumes.configMap.items' field to select the key and 'volumeMounts.subPath' to mount only that file.
Using the volumeMounts subPath property mounts a single file from a ConfigMap without obscuring existing application files. Mounting a ConfigMap directly to the directory masks the entire folder, which would break the container image defaults.
Question 120 of 597A database application running in your cluster is running out of disk space on its mounted volume. The underlying StorageClass supports dynamic volume expansion (allowVolumeExpansion: true). You need to increase the available storage for this specific application without deleting the existing PersistentVolumeClaim or losing the data currently stored on the volume.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Edit the existing PersistentVolumeClaim and increase the storage value in the resources.requests section
Increasing the requested storage value on an existing PersistentVolumeClaim triggers dynamic volume expansion if the StorageClass permits it. Deleting the PVC would destroy the data, while manual resizing bypasses Kubernetes reconciliation.
Question 121 of 597You are deploying a microservice named 'report-generator' that depends on a database. Before the 'report-generator' container starts, it must verify that the database schema is at the correct version. If the schema is outdated, a migration script must be executed. You want to ensure that the main application container only starts if the migration script completes successfully, and you want to keep the migration logic separate from the application code.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Utilize an Init Container to run the database migration script, ensuring the Pod waits for its successful completion before starting the main container.
Init containers run to completion before the main application container starts, blocking startup until the migration succeeds. Jobs lack this strict lifecycle coupling, and readiness probes incorrectly handle initialization tasks instead of traffic routing.
Question 122 of 597A microservices architecture consists of a 'frontend' deployment and a 'backend' deployment in the same 'app-prod' namespace. For security compliance, the organization requires that the 'backend' pods must only accept incoming traffic from the 'frontend' pods on port 9000. All other traffic from within the cluster or from other pods in the same namespace should be blocked. Which Kubernetes resource must be created to enforce this specific network isolation?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. A NetworkPolicy with an ingress rule allowing traffic from pods labeled 'app: frontend' on port 9000.
NetworkPolicy resources use label selectors to define precise ingress and egress rules for pod communication. Ingress and Service resources lack native layer three or four firewall capabilities needed for this internal namespace isolation.
Question 123 of 597A financial services company is managing a high-availability API currently running 20 replicas of version 'v1' through a Deployment named 'payment-api'. To maintain strict performance Service Level Agreements (SLAs), the operations team must ensure that at least 15 replicas are always operational during any update process. Simultaneously, to avoid overloading the underlying node resources, no more than 25 total replicas should ever exist at any given time during the rollout. Which strategy configuration should be applied to the Deployment manifest to meet these constraints?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set the RollingUpdate strategy with maxSurge: 5 and maxUnavailable: 5.
Configuring maxSurge and maxUnavailable to absolute integers safely dictates the exact replica counts allowed during rollouts. Using percentage values is risky here because fractional rounds up, violating the strict minimum availability constraint.
Question 124 of 597A legacy HR application only supports unencrypted HTTP traffic. However, the organization's security mandate requires all data in transit to be encrypted using TLS. To comply without modifying the legacy application code, you decide to deploy a sidecar container running 'stunnel' or Nginx to handle SSL termination. The sidecar will listen for HTTPS traffic on port 443 and proxy it to the legacy app on port 8080 over localhost. What is a critical requirement for this pattern to work?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Both containers must share the same network namespace and communicate over the 127.0.0.1 loopback address.
Containers within the same pod inherently share the exact same network namespace and loopback interface. This localhost communication is required for the proxy to forward traffic internally without complex routing configurations or host ports.
Question 125 of 597A sophisticated data analytics application requires a warm-up period after the container starts to load 5GB of reference data into local memory. During this warm-up phase, which lasts about 3 minutes, the application is technically 'running' and passing process checks, but it cannot yet process incoming API requests. If traffic is sent prematurely, the application will return 503 errors and potentially crash due to resource contention. You need to configure the Pod to ensure it does not receive traffic until the memory load is complete.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Implement a Readiness Probe that checks a specific health endpoint which only returns a 200 OK status once the data is fully loaded into memory.
A readiness probe controls traffic routing by removing unready pods from service endpoints until the endpoint succeeds. Liveness probes only manage container restarts and do not prevent premature traffic delivery during initialization.
Question 126 of 597A custom Python application is running in a pod and occasionally becomes unresponsive due to internal thread deadlocks. While the process remains running (the PID exists), it stops processing requests. You have a script at /app/health_check.py that returns an exit code of 0 if the app is healthy and non-zero otherwise. How should you configure the pod to automatically restart when the deadlock occurs?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Set up a LivenessProbe with an 'exec' action that runs 'python /app/health_check.py' to trigger a container restart upon failure.
A liveness probe using an exec action runs the diagnostic script and restarts the container if it returns a non-zero exit code. Readiness probes only remove the pod from service endpoints without triggering the required self-healing restart.
Question 127 of 597A mission-critical transaction processing application is running in the finance-prod namespace. During peak hours, several Pods of this application are being terminated by the Linux Out-of-Memory (OOM) killer, even though the total cluster memory appears sufficient. Upon investigation, you discover that several BestEffort and Burstable Pods from a testing namespace on the same nodes are consuming excess memory. To ensure the finance-prod Pods have the highest priority and are the last to be killed in case of resource contention, you must modify their resource specifications to change their Quality of Service (QoS) class. What is the most effective configuration to achieve this goal?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set the memory requests and limits to the exact same value for all containers within the Pod to achieve a Guaranteed Quality of Service class.
Matching memory requests and limits exactly grants the Guaranteed Quality of Service class, protecting pods from system OOM kills longer. PriorityClasses manage scheduling and eviction but do not change the Quality of Service during memory pressure.
Question 128 of 597You are managing a payment-processing pod that must communicate with an internal database pod named db-prod on port 5432. For security compliance, you must ensure that the payment-processing pod cannot initiate any other outbound connections to the internet or other pods in the cluster, except for DNS resolution on port 53. Which NetworkPolicy configuration strategy achieves this level of isolation?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Define an Egress NetworkPolicy with two rules: one targeting pods with the db-prod label on port 5432, and another allowing port 53 for DNS.
An egress NetworkPolicy isolates outbound traffic by strictly defining allowed destinations, implicitly denying everything else. Option B fails because it configures ingress on the database rather than restricting the source pod's outbound connections.
Question 129 of 597You are exposing a backend application through a ClusterIP Service. The application container is listening on port 8443 (HTTPS), but the frontend developers expect to reach the service at backend-service on port 443. You need to configure the Service manifest so that traffic arriving on the standard HTTPS port is correctly routed to the application's internal port.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set the service port to 443 and the targetPort to 8443 within the Service spec ports array
Mapping the service port to 443 and the targetPort to 8443 handles the translation between the exposed cluster port and the container port. Option C is wrong because the container port must match where the application is actually listening.
Question 130 of 597You are managing a Deployment named 'catalog-service' which is currently running 10 replicas. You need to perform a rolling update to a new image version. The service is under heavy load, so you must ensure that at least 8 replicas are always available to handle traffic during the update. At the same time, the cluster has tight resource constraints, so you cannot exceed a total of 12 pods (including both old and new versions) at any point during the rollout.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Define a RollingUpdate strategy where maxUnavailable is set to 2 and maxSurge is set to 2 to meet both capacity and resource constraints.
Setting maxUnavailable to 2 ensures at least 8 replicas stay available, and maxSurge to 2 limits the maximum total pods to 12. Option A violates the resource constraint by allowing up to 13 total pods during the rollout.
Question 131 of 597A mission-critical financial application requires a specific configuration file to be dynamically generated and verified before the main container starts. The verification script checks for the presence of a security certificate and validates the file structure. If the verification fails, the pod should not enter the Running state, and the main application container should not attempt to start to prevent potential security breaches. How should this pre-start validation logic be implemented in the Pod specification?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Define an initContainer that runs the verification script and shares a volume with the main application container.
An init container runs to completion before the main application container starts, blocking startup if validation fails. Option D is incorrect because a postStart hook executes concurrently with the main process, failing to prevent startup.
Question 132 of 597A specific project team in your organization has been consuming excessive CPU resources, causing other teams' workloads to stay in a Pending state. You are tasked with enforcing a strict limit of 4 CPU cores and 8Gi of memory for all Pods combined within the research-lab namespace. You need to ensure that no new Pods can be created if they exceed these cumulative limits.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Create a ResourceQuota object in the research-lab namespace defining hard limits for requests.cpu and requests.memory
A ResourceQuota sets hard limits on total aggregate resource consumption across all pods within a namespace. Option C fails because LimitRange objects enforce constraints on individual containers rather than namespace-wide totals.
Question 133 of 597A security audit requires all Pods in the 'finance-gateway' namespace to follow the principle of least privilege. One specific requirement is that the container's root filesystem must be completely immutable to prevent attackers from installing malicious software or modifying configuration files at runtime. However, the application still needs to write temporary log files to the '/var/log/app' directory for its internal operations. How should the Pod be configured to meet these conflicting requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set readOnlyRootFilesystem: true in the SecurityContext and mount an EmptyDir volume at /var/log/app.
Setting readOnlyRootFilesystem to true ensures immutability, while mounting an EmptyDir at the specific log path provides required writable storage. Option B is invalid because Pod Security Policies were removed in modern Kubernetes versions.
Question 134 of 597A critical backend service written in Python occasionally encounters a localized deadlock where the web server process remains active, but the internal request handler stops processing incoming traffic. The application exposes a health status on a local Unix socket at /var/run/app.sock. You need to configure the pod to automatically restart if the socket becomes unresponsive for more than 3 consecutive checks, with checks occurring every 10 seconds.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Define a Liveness Probe using an exec command that pings the Unix socket and set failureThreshold to 3.
A liveness probe using an exec handler runs custom commands like a Unix socket ping to restart deadlocked containers. Option C fails because httpGet handlers do not support local Unix socket paths in Kubernetes.
Question 135 of 597Your on-premises Kubernetes cluster lacks a cloud LoadBalancer. You must expose a 'data-receiver' service to a legacy external system that can only reach the cluster via a static IP and a specific port. The service should be accessible on a port between 30000 and 32767 on every node's IP address. Which Service type and configuration should be applied?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Service type NodePort with a specific nodePort value defined in the ports section
A NodePort service exposes the application on a static port across all cluster nodes, making it ideal for environments without cloud load balancers. Option D is invalid because the LoadBalancer type requires external cloud integration.
Question 136 of 597You are configuring access for a cloud-native application suite. The inventory service should be reached by external clients at the URL api.example.com/inventory and the orders service should be reached at api.example.com/orders. Both services are currently exposed internally on port 80. You have an Ingress controller installed and need to create an Ingress resource to route traffic appropriately. Which configuration structure is required?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. An Ingress resource with a single host 'api.example.com' containing multiple paths, each mapping to its respective service and port
A single Ingress host can define multiple paths to efficiently route HTTP traffic to different backend services. Option C is incorrect because consolidating paths into one resource is the standard method for path-based routing.
Question 137 of 597You are deploying a legacy Java application that requires several environment variables to be set for database connectivity. Instead of hardcoding these values in the deployment manifest, you have been provided with a properties file. You need to create a Kubernetes object from this file and inject all the key-value pairs into the application container as environment variables at once.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Create a ConfigMap from the properties file and use the envFrom field in the container specification to load all values.
The envFrom field automatically populates environment variables from an entire ConfigMap, streamlining bulk configurations. Option A is less efficient because it requires mapping individual keys using configMapKeyRef.
Question 138 of 597A containerized application runs as a non-root user with UID 2000 and needs to write to a persistent volume mounted at /var/app/data. The application fails because the volume is mounted with root ownership (UID 0) by default. You need to ensure the volume is writable by the application without running the container as root. Which securityContext setting at the Pod level should be used?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set the fsGroup field to 2000 within the pod-level securityContext to manage volume permissions
Setting fsGroup to 2000 in the pod securityContext chowns mounted volume files so the non-root user can write. Avoid runAsUser 0, which violates the non-root requirement and defeats the security purpose.
Question 139 of 597You are deploying a web application that stores its configuration in a Kubernetes ConfigMap. The application is designed to watch for changes in its configuration file and reload settings dynamically without a restart. You need to ensure that when the ConfigMap is updated via the API, the changes are eventually reflected inside the running Pod's filesystem so the application can detect the update and apply the new configuration.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Mount the ConfigMap as a volume in the Pod specification so that the kubelet automatically updates the projected files when the ConfigMap changes.
Mounting the ConfigMap as a volume lets the kubelet automatically update the projected files so the application can detect changes. Environment variables are only set at startup, so envFrom fails the dynamic reload requirement.
Question 140 of 597A Java-based microservice takes approximately 120 seconds to load its configuration from a remote server and initialize its internal cache. During this startup phase, the process is active but cannot serve traffic. If you use a Readiness probe, the pod remains unready for a long time. If you use a Liveness probe with a short initial delay, the container is killed and restarted before it can finish initializing. You need a way to protect the container during its long startup period.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Implement a Startup probe that disables Liveness and Readiness checks until the container has successfully passed its initial boot sequence.
A Startup probe suspends Liveness and Readiness checks until it succeeds, protecting slow booting containers from restarts. While increasing the Liveness delay works, it risks false restarts if the container crashes before the delay expires.
Question 141 of 597Your team is deploying a Java-based microservice that takes approximately 90 seconds to load its internal cache and warm up its connection pool. During this initialization phase, the application process is running, but it cannot handle incoming HTTP requests. If traffic is sent to the pod during this time, users receive connection timeouts. You need to configure the Pod so that the Service only routes traffic to it once the /health endpoint returns a 200 OK status. Which configuration should be applied?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Implement a readinessProbe with an httpGet check on the /health path to ensure the pod is only added to the service endpoints when ready.
A readinessProbe with an httpGet on the /health path keeps the Pod out of Service endpoints until it passes. The Liveness probe only controls restarts and cannot prevent traffic from routing to the uninitialized Pod.
Question 142 of 597Your engineering team is performing a manual canary release for a new version of the 'order-service' microservice. You currently have a Deployment named 'order-service-v1' running with 10 replicas. You have created a second Deployment named 'order-service-v2' with 2 replicas. Both versions must receive traffic from the same Service named 'order-internal-svc'. During testing, you notice that 'v2' is receiving significantly more traffic than expected relative to its replica count. You need to ensure traffic is distributed proportionally across all running Pods.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Modify both Deployments to use identical labels for the 'app' key while ensuring the Service selector targets that specific 'app' label.
Using a common app label across both Deployments allows the Service to balance traffic evenly across all matching Pods proportionally. The traffic imbalance indicates the v2 Pods likely have a different or missing label included in the selector.
Question 143 of 597Your organization is hosting a multi-tenant application where the 'frontend' service in the 'web' namespace needs to communicate with the 'api-service' in the 'backend' namespace. A strict network isolation policy is in place. You need to create a resource that allows only the 'frontend' pods (labeled 'app: frontend') from the 'web' namespace to access the 'api-service' pods on port 8080 while blocking all other ingress traffic from any other source.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Create a NetworkPolicy in the 'backend' namespace with an ingress rule selecting the 'web' namespace and pods with the label 'app: frontend'.
Applying a NetworkPolicy in the backend namespace with both pod and namespace selectors restricts ingress strictly to frontend Pods. The policy must target the destination namespace to effectively control incoming traffic from the web namespace.
Question 144 of 597A custom reporting application running in the analytics namespace needs to list all existing Pods in the same namespace to generate a resource usage report. When the application attempts to call the Kubernetes API using the default credentials provided in the Pod, it receives an error: pods is forbidden: User system:serviceaccount:analytics:default cannot list resource pods in API group. You must resolve this using the principle of least privilege. What is the most secure way to grant this access?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Create a Role that allows the list verb on pods, and create a RoleBinding to associate this Role with a new ServiceAccount used by the Pod.
Creating a dedicated ServiceAccount bound to a namespace scoped Role restricts access strictly to listing pods. Modifying the default ServiceAccount with broad ClusterRoleBindings violates least privilege and expands the attack surface unnecessarily.
Question 145 of 597A company is migrating its web portal to Kubernetes and needs to expose two separate services: 'orders-svc' and 'inventory-svc'. Both services must be reachable via a single external IP address on port 80. Traffic sent to 'portal.com/orders' should go to 'orders-svc', and traffic sent to 'portal.com/inventory' should go to 'inventory-svc'. Both services are of type ClusterIP.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Create an Ingress resource with two paths defined under a single host, each pointing to their respective backend services.
An Ingress resource provides Layer 7 routing, mapping distinct URL paths to separate ClusterIP services behind one IP. LoadBalancer and NodePort services operate at Layer 4 and cannot route traffic based on the URL path natively.
Question 146 of 597You are tasked with isolating the sensitive-data pod in the backend namespace. This pod needs to initiate connections to an external legacy API located at a specific IP address 192.168.1.50 for synchronization purposes. However, to prevent lateral movement within the cluster, the pod must be strictly prohibited from initiating any other outbound traffic to any other pods or services in the cluster. How should you define the NetworkPolicy to achieve this egress control?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Create an Egress policy with a single rule allowing traffic to the specific ipBlock of 192.168.1.50/32 and no other rules
An egress policy with a single allow rule for a specific IP block implicitly denies all other outbound traffic. Do not confuse this with an ExternalName service, which handles internal routing to an external name without restricting pod egress.
Question 147 of 597A batch processing job is designed to handle large datasets and is known to encounter intermittent network failures. The business logic dictates that if the job fails due to an error, it should be retried automatically by the Kubernetes controller. However, to prevent wasting resources on permanently broken data, the job should stop trying and be marked as failed if it does not succeed after 5 total execution attempts. How should the Job manifest be configured?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set the backoffLimit field to 4 in the Job specification to allow for a maximum of 5 attempts including the first run
The backoff limit defines the number of retries before a job is marked as failed. A value of 4 allows 1 original run plus 4 retries, totaling 5 attempts, whereas the completions field dictates successful finishes.
Question 148 of 597The deployment 'web-app' currently runs with 10 replicas. During an update to a new image, the team must ensure that at least 8 replicas are always available to handle traffic, and the total number of pods in the cluster for this deployment never exceeds 12. Which rolling update strategy parameters should be configured in the Deployment manifest?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Set maxUnavailable to 20% and maxSurge to 20% within the rollingUpdate strategy block
Setting maximum unavailable and maximum surge to 20% restricts unavailable replicas to 2 and surges to 2. This guarantees 8 replicas remain available while capping the total at 12 pods during the rollout.
Question 149 of 597A mission-critical payment processing system consists of a backend deployment and a database pod in the same namespace. To comply with strict internal security audits, you must ensure that the database pod only accepts incoming TCP traffic on port 5432 from pods specifically labeled with 'app: payment-api'. All other incoming traffic, including traffic from other pods in the same namespace or from external sources, must be explicitly denied to prevent lateral movement.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Define a NetworkPolicy with an ingress rule that selects pods with the 'app: payment-api' label and specifies port 5432.
A NetworkPolicy isolates a selected pod by implicitly denying all ingress unless explicitly allowed. By specifying the payment API label and port 5432 in the ingress rule, only matching traffic is permitted.
Question 150 of 597A high-availability banking portal requires that its three replicas are never scheduled on the same worker node to prevent a single node failure from taking down the entire service. The infrastructure consists of five distinct nodes across two availability zones. You need to configure the deployment spec to enforce this constraint strictly during scheduling so that no two pods from this deployment ever share a node.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Use podAntiAffinity with requiredDuringSchedulingIgnoredDuringExecution specifying the app label
Using required pod anti-affinity strictly prevents the scheduler from placing multiple pods with the same label on one node. Preferred anti-affinity acts only as a soft hint and will not strictly guarantee distribution.
Question 151 of 597An enterprise application deployment named order-service is failing because the application starts faster than the backend SQL database. The application does not have built-in retry logic and crashes immediately if it cannot establish a connection. To prevent this, you need to implement a mechanism that ensures the main application container only starts once the database is reachable on port 5432 at the address db-service.internal. Which of the following configurations is the most appropriate for this scenario?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Include an initContainer in the Pod specification that uses a busybox image to run a network check loop until the database port is open.
An init container runs to completion before the main application container starts, blocking startup until the database is reachable. Liveness and readiness probes manage running containers but do not delay initial startup.
Question 152 of 597A DevOps engineer is hardening a containerized Python application that processes user-uploaded images. The container must not run as the root user for security reasons. Additionally, the application requires the capability to bind to a privileged port (e.g., port 443) and needs to ensure that its filesystem is read-only, except for a specific temporary directory used for image processing (/tmp/uploads). You need to define the correct SecurityContext settings.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Apply runAsUser: 1000, readOnlyRootFilesystem: true, and add the NET_BIND_SERVICE capability in the securityContext of the container.
Setting a non-root user and a read-only root filesystem meets baseline security requirements. Adding the NET_BIND_SERVICE capability explicitly permits the non-root process to bind to privileged ports like 443.
Question 153 of 597You are configuring an Ingress resource to route traffic for a corporate portal. The requirement is that all requests starting with '/static' must be sent to the 'assets-service', while all other requests (the catch-all) should be directed to the 'frontend-service'. You are using a controller that supports the 'pathType' field. Which configuration ensures that '/static/images/logo.png' is correctly routed to the assets-service?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set the path to '/static' with a pathType of 'Prefix' for the assets-service.
Prefix path type matching routes any request that begins with the defined path. Exact path type would require a perfectly matching URL, and ImplementationSpecific relies on custom controller logic.
Question 154 of 597An application requires a specific configuration file, 'extra-settings.json', to be located in the directory '/app/config/'. This directory is already populated with several other system-critical files during the image build process. You have the 'extra-settings.json' stored in a ConfigMap. You need to mount this file into the directory without deleting or hiding the existing files already present in '/app/config/'.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Utilize the 'subPath' property within the 'volumeMounts' section to map the specific key from the ConfigMap to the exact file path.
Using the subPath property mounts a single file from a volume without obscuring existing files in the target directory. A standard volume mount would hide the original directory contents.
Question 155 of 597A high-performance trading platform is deploying a new microservice called trade-validator in a production cluster that hosts multiple other workloads. During periods of extreme market volatility, the nodes hosting the trade-validator pods often experience severe resource contention. Even though the pods have memory and CPU requests defined, they are frequently evicted by the Kubelet to reclaim resources for other system processes because the limits are either not defined or do not match the requests. To prevent these critical evictions and ensure the highest scheduling and runtime stability, the engineering team must ensure the pods are assigned the Guaranteed Quality of Service class. Which of the following configuration strategies must be implemented in the pod specification?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Configure both memory and CPU requests and limits to the exact same values for every container within the pod specification.
Assigning identical CPU and memory requests and limits to every container grants the Guaranteed Quality of Service class. This provides the highest protection against eviction, while a PriorityClass only affects scheduling.
Question 156 of 597You are configuring an Ingress resource to host a multi-service web application. Requests to 'portal.example.com/shop' must be routed to the 'shopping-service' on port 80. Requests to 'portal.example.com/admin' must be directed to the 'admin-service' on port 8080. Additionally, all traffic to 'portal.example.com' must be encrypted via HTTPS using a certificate stored in a Secret named 'portal-certs'.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Define a single Ingress with a 'tls' section referencing the secret and 'rules' containing multiple paths under the same host.
Defining a single Ingress with a tls section and multiple path rules correctly handles routing and HTTPS termination. Creating separate Ingress resources for the same host often causes controller conflicts, making a single resource the required approach.
Question 157 of 597Your organization is migrating a legacy monolithic application that needs to communicate with an external cloud-based logging service. The logging service requires a complex, custom-built authentication handshake and payload encryption that the legacy application cannot perform. To avoid modifying the legacy code, you decide to use a multi-container Pod pattern where a helper container handles all the external communication, authentication, and encryption details on behalf of the legacy app.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure an Ambassador container that acts as a local proxy, allowing the legacy app to send logs to localhost while the proxy handles authentication.
The Ambassador container pattern acts as a local proxy, handling complex external authentication so the main app connects only to localhost. A standard sidecar simply extends functionality, whereas an Ambassador specifically brokers outside connections.
Question 158 of 597A high-performance computing task requires processing a static dataset of 500GB that is updated once a week. Because the dataset is too large to include in the container image and is shared by multiple concurrent pods, you must ensure that each pod can access the data locally at /mnt/data. The storage solution must be persistent even if all processing pods are deleted, but it does not need to be accessible from outside the cluster.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Provision a PersistentVolume (PV) and a PersistentVolumeClaim (PVC) with ReadWriteMany access mode to mount the volume into all pods.
PersistentVolumes and PersistentVolumeClaims provide storage with a lifecycle independent of pods, and ReadWriteMany access allows concurrent mounting. The hostPath and emptyDir options fail the persistence requirement when nodes or pods are recycled.
Question 159 of 597An engineering team is deploying a distributed data processing application in a Kubernetes cluster. The main application container requires a specific configuration schema to be present in a local directory before it can start. However, this schema is dynamically generated by a specialized tool that takes about 30 seconds to run and requires different environment variables than the main application. The team wants to ensure the main container only starts once the schema file is successfully created in the shared volume. Which design pattern should be implemented to handle this dependency correctly?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Define an Init Container in the Pod spec to run the specialized tool and write the schema to a shared EmptyDir volume.
Init containers run sequentially and must complete successfully before the main application containers start. Using a postStart hook runs concurrently with the main container, creating a race condition, whereas an init container guarantees the dependency is met.
Question 160 of 597A legacy application writes its logs to a file located at /var/log/app.log instead of stdout. To integrate with the cluster's Fluentd-based logging system, you need to deploy a sidecar container in the same Pod that reads this file and streams the content to its own standard output. Both containers must access the same file location.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use an emptyDir volume mounted at /var/log in both the application and the sidecar containers
An emptyDir volume provides a temporary shared disk that both containers in the same Pod can mount to read and write files. A persistent volume is unnecessary for temporary logs, and sharing the process namespace is less clean.
Question 161 of 597A batch processing job must handle 50 work items. To minimize processing time, the team wants to run 5 instances of the processing logic concurrently. The Job must ensure exactly 50 successful completions before it is considered finished. If an instance fails, it should be retried. Which Job specification fields should be configured to meet these concurrency and completion goals?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Set completions to 50 and parallelism to 5 in the Job's spec section
The completions field defines the total successful pod finishes required, while parallelism controls the active pods at once. Replicas are used for Deployments, not run-to-completion batch Jobs.
Question 162 of 597A development team is working in a shared namespace called 'dev-sandbox'. Recently, some resource-heavy containers have been causing node pressure, leading to the eviction of smaller, critical management Pods. You have been asked to implement a solution that limits the total amount of CPU and Memory that all Pods combined can consume in this namespace, and also ensures that every new Pod created without explicit limits receives a default set of resource constraints.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Create a ResourceQuota to limit total namespace usage and a LimitRange to provide default requests and limits for individual containers.
A ResourceQuota caps the total aggregate resources consumed within a namespace, while a LimitRange applies default bounds to individual containers. PriorityClasses only handle eviction order during node pressure and do not restrict total namespace limits.
Question 163 of 597A corporate security policy mandates that no container should ever run with administrative privileges or as the root user. You are deploying a web server that by default runs as UID 0. You need to modify the Pod specification to force the container to run as user 1001 and prevent it from ever gaining root access through privilege escalation.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Add a securityContext block with runAsUser set to 1001 and allowPrivilegeEscalation set to false
The securityContext block directly enforces runtime constraints, letting you set the user ID and disable privilege escalation. Rebuilding the image fails because Kubernetes configurations must override image defaults to guarantee the security policy at runtime.
Question 164 of 597A developer is deploying a Pod that runs as a non-root user (UID 1000). The container needs to write logs to a PersistentVolume mounted at '/var/log/app'. However, the volume is provisioned with root-only write permissions by the storage provider, causing the application to fail with 'Permission Denied'. You cannot change the underlying storage provider settings. Which securityContext setting should be applied at the Pod level to resolve this?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Set fsGroup: 2000 in the Pod securityContext to change the ownership of the mounted volume to a specific group.
Setting fsGroup in the pod securityContext instructs Kubernetes to modify the mounted volume ownership, granting access to the specified group. Using privileged mode or root introduces severe security risks and violates standard container hardening practices.
Question 165 of 597Your organization is migrating a legacy suite of web services to Kubernetes. You need to expose three different internal Services: 'orders-svc' on port 80, 'catalog-svc' on port 80, and 'identity-svc' on port 80. The requirement is to use a single public LoadBalancer IP address. Traffic must be routed based on the URL path: '/orders' should go to 'orders-svc', '/catalog' to 'catalog-svc', and any other traffic should be directed to 'identity-svc'. Which Kubernetes resource and configuration should be used?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. An Ingress resource with path-based rules for /orders and /catalog, and a defaultBackend set to 'identity-svc'.
An Ingress resource manages Layer 7 routing, letting you map specific URL paths to different backend services. The defaultBackend property catches any traffic that does not match your explicit path rules, solving the fallback requirement perfectly.
Question 166 of 597A high-traffic web application currently runs 10 replicas under a Deployment named web-prod. You want to test a new version of the application, v2, by sending approximately 10% of the live traffic to it using a canary deployment strategy. You create a new Deployment named web-canary with 1 replica using the v2 image. Both deployments are in the same namespace. How can you ensure the existing Service named web-service distributes traffic across both versions without modifying the Service configuration?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Update the labels of the web-canary pods to match the selector defined in the web-service and ensure the pod labels are identical to web-prod.
Matching pod labels to the existing service selector naturally balances traffic proportionally based on pod count. The Ingress option requires modifying routing rules and creating separate services, which violates the stated restriction.
Question 167 of 597A payment-processing microservice named 'secure-pay' in the 'finance-prod' namespace must be restricted for security reasons. Policy dictates that this microservice can only initiate outbound connections to a specific external gateway at the IP 198.51.100.24 on port 443. All other egress traffic to any destination, internal or external, must be blocked. Which NetworkPolicy configuration achieves this goal?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. An Egress policy with an empty podSelector and an allow rule for the specific IP block and port
A NetworkPolicy is additive, so defining an egress rule for the specific IP and port implicitly blocks all other outbound traffic. NetworkPolicy does not support explicit deny rules, making the sequential rule option invalid.
Question 168 of 597An application requires a configuration file named app-config.yaml to be present in the directory /etc/myapp/. However, this directory already contains other critical files generated at runtime. When you try to mount a ConfigMap to this path using the volumeMounts.mountPath field, the existing files in /etc/myapp/ disappear. How can you mount the single file from the ConfigMap without overwriting the rest of the directory content?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Use the subPath property within the volumeMounts section to mount only the specific key from the ConfigMap to the desired file path.
The subPath property mounts a single file from a volume without masking the existing files in the target directory. Standard volume mounts always overlay the entire directory, which is why your runtime files disappear.
Question 169 of 597A legacy monitoring agent is deployed as a container within a Pod. This agent communicates using an unencrypted protocol on port 8080 and cannot be modified to support encryption. For compliance reasons, all traffic leaving the Pod must be encrypted using TLS. You decide to use a sidecar container to act as a local proxy that handles the encryption before the traffic reaches the network. Which configuration ensures the legacy application traffic is properly intercepted and encrypted?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Set the legacy agent to send traffic to localhost on port 443 where the sidecar container is listening and encrypting
Containers in the same pod share a network namespace, so routing localhost traffic to the proxy port works seamlessly. This intercepts the payload locally, allowing the sidecar to encrypt the outbound traffic.
Question 170 of 597You are configuring an Ingress resource to manage traffic for a SaaS platform. The requirement is that traffic sent to 'app.example.com/api' must be routed to a Service named api-service on port 8080, while traffic sent to 'app.example.com/static' must be routed to a Service named assets-service on port 80. Both services are in the same namespace. Which Ingress configuration structure is correct for this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Use a single Ingress resource with a host 'app.example.com' and a list of paths under the 'http' section, each mapping to its respective service.
A single Ingress resource efficiently handles multiple paths for a single host by mapping each path to a specific backend. Creating multiple Ingress resources for the same host often causes controller conflicts and unnecessary routing complexity.
Question 171 of 597An application pod named 'report-worker' in the 'analytics' namespace needs to be able to list all other pods in the same namespace to coordinate a distributed task. When the application starts, it receives a '403 Forbidden' error from the Kubernetes API. You need to resolve this by providing the pod with the minimum necessary permissions following security best practices.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Create a Role with 'list' permissions for 'pods', a ServiceAccount for the worker, and a RoleBinding to link them.
Creating a dedicated ServiceAccount bound to a namespace Role via a RoleBinding grants strictly scoped API access. Assigning cluster-admin grants excessive permissions, violating security best practices and creating dangerous cluster-wide risks.
Question 172 of 597A security administrator requires that the processor container in the compliance namespace is hardened to mitigate potential privilege escalation. The application must run with a specific non-root user ID 1001, and the container should be prevented from gaining more privileges than its parent process. Additionally, the root filesystem should be mounted as read-only to ensure integrity. Which configuration block should be added to the container specification to meet these requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Define a securityContext with runAsUser 1001, allowPrivilegeEscalation set to false, and readOnlyRootFilesystem set to true
The securityContext configures runtime security at the pod or container level, directly enforcing the required user ID, blocking privilege escalation, and mounting the root filesystem as read-only. PodSecurityPolicy was removed and is no longer valid.
Question 173 of 597A data processing task is implemented as a Kubernetes Job. This task is prone to occasional network timeouts, but it is idempotent and can be safely retried. Your management wants to ensure that the Job is not abandoned after the first failure but also wants to prevent it from running indefinitely if there is a permanent bug. It should stop attempting and mark the task as failed after 5 total unsuccessful attempts. Which Job parameter must be set?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Configure 'backoffLimit: 4' in the Job specification to allow for 4 retries (total of 5 attempts) before the Job is considered failed.
The backoffLimit specifies the number of retries before a Job fails. Setting it to 4 allows the initial attempt plus four retries, resulting in exactly five total attempts. The activeDeadlineSeconds limits duration, not attempt counts.
Question 174 of 597A data processing company uses a Kubernetes Job to run heavy extract-transform-load (ETL) tasks. The Job is configured to process 100 data chunks in total. To optimize performance, the team wants to ensure that 10 chunks are being processed simultaneously at any given time. If a single task fails, it should be retried up to 5 times before the entire Job is marked as failed. Which set of parameters should be configured in the Job manifest to achieve this behavior? Correct answer
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set completions: 100, parallelism: 10, and backoffLimit: 5.
The completions, parallelism, and backoffLimit fields directly map to total chunks, simultaneous workers, and failure retries. Other options confuse these parameters or introduce unrelated concepts like CronJobs and active deadlines.
Question 175 of 597A financial institution is deploying a high-security transaction processing application. The infrastructure team has designated a specific set of worker nodes with hardware-level encryption as dedicated resources for this application. These nodes are marked with a Taint 'security=high:NoSchedule' to prevent regular workloads from using them. You need to configure the 'transaction-processor' Deployment so that its Pods are allowed to run on these nodes and specifically prefer them over any other available hardware in the cluster. Correct answer
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Add a Toleration for the security taint and implement a nodeAffinity rule with a requiredDuringSchedulingIgnoredDuringExecution constraint.
Tolerations allow pods to be scheduled on tainted nodes, while nodeAffinity enforces placement based on specific hardware labels. This combination ensures strict targeting compared to the more basic nodeSelector.
Question 176 of 597An engineering lead requires that during the update of the web-portal deployment, which currently runs 10 replicas, the update process must be strictly controlled. The total number of pods during the transition must never exceed 12 to avoid over-provisioning node resources, and the number of available pods must never drop below 9 to maintain service availability. Which RollingUpdate strategy parameters should be configured in the Deployment manifest?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Specify a strategy with maxSurge set to 2 and maxUnavailable set to 1 in the RollingUpdate configuration block
MaxSurge controls how many pods exceed the desired count, so two allows exactly twelve. MaxUnavailable dictates the drop ceiling, so one keeps nine pods available. Other percentages or values violate the stated resource constraints.
Question 177 of 597An engineering team is deploying a clustered database using a Kubernetes StatefulSet. Each member of the cluster requires a stable, predictable network identity (e.g., mongodb-0.mongodb-service) to perform internal synchronization and leader election. Unlike standard microservices, these database instances must be able to discover each individual peer's IP address directly rather than being load-balanced by a virtual IP. Which configuration is required to achieve this specific networking requirement for the database cluster?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Create a Headless Service by setting the clusterIP field to None in the Service specification.
A Headless Service, created by setting clusterIP to None, skips assigning a virtual IP. DNS returns individual Pod IPs instead, enabling direct peer discovery required for StatefulSet databases. Standard Services blindly load-balance traffic.
Question 178 of 597A financial services company is migrating its client-portal frontend application to a Kubernetes cluster. The application must interact with an on-premises legacy SOAP backend that requires strict MTLS authentication and utilizes a proprietary encryption protocol for all payloads. To simplify the application code and avoid embedding complex security libraries within the frontend container, the engineering team decides to implement a pattern where the frontend communicates with a local proxy on localhost. This proxy handles all encryption, decryption, and MTLS handshakes before forwarding requests to the on-premises backend. Which architectural pattern is being implemented to provide this abstraction layer within the Pod?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Utilizing an ambassador container that acts as a local proxy to handle complex communication with the external legacy system
The ambassador pattern is specifically designed to provide a local proxy for the main container to reach external services. This abstracts the complexity of mutual TLS and proprietary encryption away from the primary application code.
Question 179 of 597Your company uses an Ingress controller to expose several services. You need to configure a single Ingress resource that routes traffic coming to 'api.example.com/v1' to a service named 'api-v1-service' and traffic coming to 'api.example.com/v2' to 'api-v2-service'. Both services operate on port 80. How should the 'rules' section of the Ingress manifest be structured to achieve this path-based routing?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Use a single rule with the host 'api.example.com' and a list of two paths under the 'http' section, each pointing to their respective service.
An Ingress rule for a specific host can contain multiple paths under the paths section. Each path specifies a path type and a backend, which is the standard for path-based routing.
Question 180 of 597You are managing a microservices-based application where a 'payment-service' and a 'logger-service' reside in the same namespace. Corporate security policy dictates that the 'payment-service' should only be able to receive traffic from the 'frontend' pod and must be completely blocked from communicating with or receiving traffic from the 'logger-service'. No NetworkPolicies currently exist in the namespace. What is the first step to implement this isolation?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Apply a NetworkPolicy that selects the payment-service pods and defines an ingress rule allowing only pods with the label 'app=frontend'.
Network policies act as a firewall for pods. By creating a policy that selects the payment service and only allows traffic from pods labeled app=frontend, all other internal traffic is implicitly denied.
Question 181 of 597Your organization wants to implement a Blue-Green deployment strategy for a stateless API. Version blue is currently receiving traffic via a Service named api-service using the label version: blue. You have deployed version green and verified its functionality. You now need to switch 100% of the production traffic to the green version with minimal downtime by modifying the existing Service manifest.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Update the selector in the Service manifest to match the labels of the green deployment
Changing the service selector is the standard way to perform a blue-green switch in Kubernetes. Traffic is immediately routed to the new pods without changing the service IP.
Question 182 of 597An application named 'secure-processor' needs to access two different types of sensitive information: a static API key that rarely changes and a temporary session token that is rotated every 15 minutes by an external security vault. The security team insists that the session token must never be stored on the node's physical disk and should only exist in memory. What is the most secure and efficient way to provide these two pieces of data to the container?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Store the API key in a Secret and mount it as a volume, and use a CSI driver (like HashiCorp Vault) to mount the session token as an in-memory volume.
Secrets are intended for sensitive data and are backed by temporary storage in modern Kubernetes. Using a specialized driver for the rapidly rotating token ensures it is fetched directly from the vault and never touches the disk.
Question 183 of 597Your team is managing a production Deployment named 'api-gateway' which currently runs 10 replicas. Due to strict Service Level Objectives (SLOs), the application must always have at least 80% of its desired capacity available during a rolling update. Additionally, the cluster has limited resource quotas, so the Deployment cannot exceed more than 120% of its desired replica count at any point during the update process. Which strategy configuration parameters must be applied to meet these constraints?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. Set maxUnavailable to 2 and maxSurge to 2 in the strategy section.
Setting max unavailable to 2 ensures at least 8 pods are running, meeting the 80% availability requirement. Setting max surge to 2 allows up to 12 pods total, perfectly matching the resource constraints.
Question 184 of 597Your organization is updating a mission-critical deployment named payment-api which currently has 10 replicas. The update must strictly adhere to an availability policy where 100% of the required capacity (10 replicas) must be available at all times during the rolling update. Additionally, the cluster has limited spare resources, so you want to ensure that no more than 3 extra pods are created during the process. Which strategy configuration meets these requirements?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Set maxSurge to 3 and maxUnavailable to 0 in the deployment's rollingUpdate strategy section.
Setting max unavailable to 0 ensures that the current number of available pods never drops below the desired count. Setting max surge to 3 allows the deployment to start 3 new pods before stopping old ones.
Question 185 of 597A legacy application writes raw log files to a local directory at /mnt/data/logs. These logs must be processed by a sidecar container that converts them to JSON and sends them to a central server. Both containers run in the same Pod and need shared access to the logs without persisting them on the host node's physical disk after the Pod is deleted. What is the most efficient volume configuration?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Define an emptyDir volume and mount it at /mnt/data/logs in both the app and sidecar containers
An empty directory volume is created when a pod is assigned to a node and exists as long as that pod is running. It is the standard way for containers in a pod to share files locally without persisting data.
Question 186 of 597A high-performance computing company needs to ensure that their 'data-cruncher' workloads are only scheduled on nodes equipped with NVMe storage. These specific nodes have been labeled with 'storage-type=nvme'. However, other generic workloads should not be prevented from using these nodes if they are idle, but the 'data-cruncher' must specifically target them. Which configuration provides the most appropriate scheduling constraint for this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: C. Use a nodeSelector in the Pod specification with the key-value pair storage-type: nvme to force the scheduler to select these specific nodes.
A node selector is the simplest and most effective way to constrain pods to nodes with particular labels. It ensures the data cruncher only lands on NVMe nodes without blocking other pods.
Question 187 of 597You are managing a multi-tier application in a namespace called 'production'. To comply with internal security audits, you must implement a network isolation policy. The requirement states that the 'backend-db' Pods should only accept incoming traffic on port 5432 from Pods labeled 'app: api-gateway' within the same namespace. All other incoming traffic from other Pods or other namespaces must be blocked. You are tasked with creating the NetworkPolicy to enforce this restriction.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Define an Ingress NetworkPolicy for the backend-db pods with a podSelector matching 'app: api-gateway' and a specified port of 5432.
An ingress NetworkPolicy applied to the backend-db pods whitelists specific traffic sources. By defining a podSelector matching the api-gateway and restricting the port, you automatically block all non-matching traffic from other pods or namespaces.
Question 188 of 597The testing namespace in your cluster frequently consumes all available CPU cores, causing scheduling delays for mission-critical pods in the production namespace. You need to enforce a strict policy that limits the total CPU request for all pods combined in the testing namespace to 4 cores and total memory to 8Gi, without manually editing every individual pod manifest. Which Kubernetes object should be created in the testing namespace?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. A ResourceQuota object that specifies hard limits for requests.cpu and requests.memory at the namespace level
A ResourceQuota successfully restricts aggregate resource consumption per namespace. LimitRange is the strongest distractor, but it sets default bounds for individual containers rather than capping total usage.
Question 189 of 597A microservice requires a configuration directory containing several files: settings.conf, proxy.json, and logging.properties. These files are managed by a central team and updated frequently via a ConfigMap. You must ensure that these files are available at the path /etc/app/config inside the container, and that updating the ConfigMap eventually updates the files in the container without a pod restart.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Mount the ConfigMap as a volume at the specified mountPath within the container specification
Mounting a ConfigMap as a volume correctly projects files into the container and automatically updates them. Environment variables are the strongest distractor, but they require a pod restart to reflect updates.
Question 190 of 597A Python Flask application is deployed in a production namespace and relies on a persistent connection to a Redis cache. Occasionally, the connection to the cache is lost due to transient network issues, causing the application to return HTTP 500 errors while the process remains running. The infrastructure team requires a mechanism to automatically restart the container if it can no longer communicate with Redis using a health check script at /app/check_redis.py. How should this be implemented in the Pod specification?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure a livenessProbe using the exec field to run the /app/check_redis.py script within the container
A liveness probe correctly detects broken states and triggers automatic container restarts. A readiness probe is the strongest distractor, but it only removes traffic without restarting.
Question 191 of 597You are deploying a legacy web application that only communicates over unencrypted HTTP. A new security requirement mandates that all traffic leaving the pod to an external API must be encrypted using mTLS. To avoid modifying the legacy code, you decide to use a proxy container that will run in the same pod, listen for local HTTP traffic from the app, and forward it as HTTPS to the external service.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Configure an Ambassador container in the Pod to act as a local proxy for outgoing traffic and handle the encryption logic.
The Ambassador pattern correctly acts as a local proxy to handle outgoing traffic encryption. An initContainer is the strongest distractor, but it only runs before startup, not alongside.
Question 192 of 597An enterprise financial application generates operational metrics in a proprietary binary format and sends them to a local Unix socket. The monitoring team requires these metrics to be available in Prometheus-compatible text format for the central observability platform. You need to implement a solution that bridges this gap without modifying the original application source code or its container image, ensuring the transformation logic is decoupled from the business logic.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Implement an Adapter container within the same Pod that reads from the Unix socket and exposes a web endpoint with Prometheus metrics.
The Adapter pattern successfully translates non-standard outputs into a format external systems expect. A generic sidecar is the strongest distractor, but it lacks the specific translation role.
Question 193 of 597A development team is deploying a microservice that generates massive amounts of data in a short time. They have noticed that their Pods are frequently being terminated with an 'OOMKilled' status. Upon inspection, the containers have a memory limit of 512Mi, but the application occasionally peaks at 600Mi during data bursts. The team wants to allow the application to occasionally exceed its requested memory during bursts if the node has capacity, but still enforce a hard limit to prevent node instability. How should the resources be configured in the Pod spec?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set memory requests to 512Mi and memory limits to 1Gi.
Setting memory requests lower than limits allows bursting while maintaining a hard cap. Removing limits is the strongest distractor, but it risks node instability without bounds.
Question 194 of 597A high-traffic e-commerce platform is performing a rolling update of its payment-processing deployment which currently runs 10 replicas. To ensure high availability and prevent resource exhaustion on the cluster nodes during the transition, the DevOps team has specified that at least 80% of the desired capacity must be available at all times, and the total number of pods during the update should not exceed 130% of the desired count.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Define a RollingUpdate strategy where maxUnavailable is 2 and maxSurge is 30%.
Setting maxUnavailable to 2 keeps eight pods available, satisfying the 80 percent minimum. Setting maxSurge to 30 percent allows up to 13 pods total, preventing the exact 3-pod limit from being misunderstood as an absolute cap.
Question 195 of 597A security-hardened environment hosts a data-crunching microservice that processes sensitive information in an isolated namespace. During a recent audit, the security team discovered that the default ServiceAccount token is automatically mounted at /var/run/secrets/kubernetes.io/serviceaccount within the pod's containers. Since this microservice performs purely local data transformations and never needs to interact with the Kubernetes API server, having this token present poses an unnecessary security risk. You are required to modify the Pod specification to prevent the automatic mounting of these credentials across all containers in the Pod to adhere to the principle of least privilege.
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Set the field automountServiceAccountToken to false at the Pod level specification.
Setting automountServiceAccountToken to false at the Pod level cleanly prevents the default API credentials from being mounted. Overwriting the path with an emptyDir is a hacky workaround that fails to follow Kubernetes security best practices.
Question 196 of 597Your engineering team is deploying a new version of a legacy banking application that requires a specific database schema migration to be completed before the main application container starts. If the migration fails, the application container should not attempt to start to avoid data corruption. The migration script is packaged as a separate container image. How should you structure your Pod manifest to ensure this strict sequence is followed in a production environment? Correct answer
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Define the migration container within the initContainers section of the Pod specification to ensure it completes successfully before the app container starts.
Init containers run to completion before app containers start, guaranteeing the migration finishes first. If it fails, the pod aborts, which prevents data corruption. Liveness probes or sidecars do not gate startup in this strict sequence.
Question 197 of 597Your team needs to provide a large configuration file (over 1MB) containing environment-specific parameters to a web server pod. This file is not sensitive and needs to be updated occasionally without rebuilding the container image. The web server expects the file to be available at /etc/config/settings.conf. Which method is most appropriate for delivering this configuration while allowing the pod to see updates without a full restart?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: B. Store the file content in a ConfigMap and mount it as a volume at /etc/config/ in the Pod specification.
ConfigMaps handle non-sensitive configuration data and bypass the 1MB limit typical of environment variables. When mounted as a volume, Kubernetes automatically updates the files without requiring a full pod restart, perfectly meeting all requirements.
Question 198 of 597An enterprise financial application generates raw transaction logs in a proprietary binary format and writes them to a shared volume. The centralized logging infrastructure used by the compliance team only ingests logs in JSON format via a Fluentd-compatible agent. You need to implement a solution that sits alongside the main application to perform this data conversion in real-time without modifying the core application code or its container image. Correct answer
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: A. Deploy a Sidecar container using the Adapter pattern to transform proprietary logs into JSON before they are sent to the logging agent.
The sidecar adapter pattern modifies or filters data from a shared volume without altering the main application. An init container runs only before startup, so it cannot continuously convert real-time logs during the application lifecycle.
Question 199 of 597A sensitive data-processing Pod named 'batch-exporter' is deployed in the 'secure-processing' namespace. To comply with corporate networking policies, this Pod must be restricted from initiating any outbound traffic to the public internet, except for a specific external backup server located at the IP address 203.0.113.50. All other egress traffic to the internal cluster and external networks must be blocked. Which NetworkPolicy configuration achieves this requirement?
Tap an answer — you get instant feedback and the reasoning.
Show answer & explanation
Correct answer: D. An Egress policy with a single rule containing an ipBlock that specifies 203.0.113.50/32.
An Egress policy restricts outbound traffic and acts as a whitelist. By specifying only the target ipBlock, all other traffic is implicitly denied. Ingress policies control incoming traffic, not outbound connections.
Study on mobile
Get CertPunch for iOS or Android.