1. Explain the difference between a Pod's restart policy (Always, OnFailure, Never) and how it interacts with the kubelet's crash-loop backoff mechanism. When would you choose OnFailure over Always for a production workload?
The restart policy determines whether the kubelet restarts a container after it exits: Always restarts regardless of exit code, OnFailure only on non-zero exit, and Never prevents restarts. The kubelet implements exponential backoff (10s, 20s, 40s up to 5min) to avoid hammering failed containers. OnFailure is appropriate for batch jobs or sidecar containers that should only restart on actual errors, not successful completion, whereas Always suits long-running services like web servers that should recover from transient failures automatically.
2. Design a Pod spec for a senior Platform Engineer that demonstrates proper resource requests, limits, and QoS class placement. What happens when a Node runs out of memory and your Pod has QoS class Burstable?
A well-designed Pod includes CPU and memory requests (for scheduling and QoS calculation) plus limits (hard caps enforced by cgroups). Requests equal limits creates Guaranteed QoS (highest priority eviction protection), requests less than limits creates Burstable (medium priority). When a Node has memory pressure, the kubelet evicts Pods in reverse priority order: Best Effort first, then Burstable by memory usage ratio, then Guaranteed if necessary. A Burstable Pod will be among the first evicted if it exceeds its request, making it unsuitable for critical workloads without proper requests tuned to expected usage.
3. A Pod is stuck in Pending state for 30 minutes. Walk through the debugging steps a Platform Engineer should take using kubectl and what Pod conditions or events might reveal the root cause.
First, run kubectl describe pod to check the Status, Conditions (PodScheduled, Initialized, Ready), and Events fields for scheduling failures or admission controller rejections. Check node capacity and taints with kubectl get nodes and kubectl describe node, then verify resource requests don't exceed available capacity. Examine init containers (InitializedCondition) as they must complete before the main container starts; a stuck init container blocks the whole Pod. Finally, check admission webhooks in cluster and whether image pull is failing silently by inspecting the ContainersReady condition and looking for ImagePullBackOff or similar status.
4. Explain init containers and their role in Pod initialization. In what scenarios would a Platform Engineer use init containers instead of readiness probes, and what are the trade-offs?
Init containers run sequentially before app containers start; they must complete successfully (exit code 0) or the Pod fails. They are ideal for setup tasks like downloading configuration, waiting for dependencies, or validating environment state. Unlike readiness probes which check ongoing health, init containers guarantee a one-time setup phase and prevent the app container from starting in a bad state. The trade-off is that init containers extend startup time and failures block the entire Pod; readiness probes are more flexible for detecting transient issues during steady-state operation.
5. A Pod has multiple containers. Container A logs successfully but Container B never produces logs despite the container being in Running state. What are the possible causes and how would you troubleshoot?
Container B might be redirecting stdout/stderr to files instead of the container's standard streams; check kubectl logs with specific container name and file paths in the container filesystem using kubectl exec. The container might be crashing immediately after startup but with a restart policy that restarts it too quickly for you to catch; check container status with kubectl describe pod and look for CrashLoopBackOff. Verify that the container's entrypoint and command are actually outputting logs and not silencing stderr. Also check if logs are being collected by a sidecar logging container or if the app writes to a non-standard descriptor; in some legacy apps, this requires binding /proc/1/fd/1 to understand log flow.
6. What are ephemeral containers and when would a Platform Engineer use them in production? What are the security and operational implications?
Ephemeral containers (alpha/beta feature depending on Kubernetes version) are temporary containers attached to a running Pod for debugging without stopping the Pod or restarting it. Use them when you need to inspect a distroless or minimal image that has no shell or debugging tools, avoiding the need to rebuild images with debug sidecar containers. Security implications include that they inherit the Pod's service account and security context, so they can access sensitive mounts and network namespaces; operationally, they're useful in production only if cluster RBAC strictly limits who can create them and if audit logging captures their usage.
7. Describe the Pod lifecycle phases (Pending, Running, Succeeded, Failed, Unknown) and explain under what conditions a Pod transitions between each phase. When would you see Unknown phase in production?
Pending means the Pod is waiting for resources or scheduling, Running means all containers are started, Succeeded/Failed indicate the Pod completed (usually for batch jobs), and Unknown means communication with the kubelet was lost. Phase transitions occur when the scheduler assigns a node (Pending to Running), containers exit (Running to Succeeded/Failed), or when init containers fail (stays in Pending). Unknown phase appears when the Node goes offline or the kubelet becomes unresponsive; the control plane cannot confirm container status and waits for the node to rejoin or a pod eviction timeout before cleaning up the Pod.
8. Design a liveness and readiness probe strategy for a slow-starting service that takes 60 seconds to become healthy. What probe parameters would you set and why, and what happens if the probes are misconfigured?
Set a readiness probe with initialDelaySeconds of 60 to avoid sending traffic before the service is ready, periodSeconds of 10 to check health frequently once running, and failureThreshold of 3 so temporary blips don't remove traffic. For liveness, use a longer initialDelaySeconds (120) and higher failureThreshold (5) to avoid killing a legitimately slow startup, but keep it lower than readiness to detect hangs. Misconfigured probes (too strict thresholds or short delays) cause unnecessary restarts and cascading failures, while too lenient probes allow unhealthy traffic and slow recovery. A common mistake is setting readiness probe identically to liveness, which can cause thrashing if a service temporarily can't handle health checks.
9. Explain how Pod priority and preemption work in Kubernetes. How would you design a PriorityClass strategy for a mixed workload cluster with critical services and batch jobs?
PriorityClass assigns numeric priority to Pods; when a high-priority Pod cannot be scheduled, the scheduler preempts (evicts) lower-priority Pods to make room. Design a three-tier strategy: critical system services get highest priority (e.g., 1000000), production workloads get medium (e.g., 100000), and batch jobs get low (e.g., 0). Use Pod Disruption Budgets in conjunction to protect even low-priority workloads from unnecessary preemption during voluntary disruptions like drains. Set preemption policy to PreemptLowerPriority for critical services and never for best-effort batch; this prevents batch jobs from evicting production services while still allowing batch to use spare capacity.
10. A Pod requires access to host-level networking (hostNetwork: true) and host process ID namespace (hostPID: true). Explain the security implications and under what conditions a Platform Engineer should allow this in production.
hostNetwork exposes the Pod to the host's network stack, allowing sniffing of all node traffic and bypass of NetworkPolicies; hostPID allows the Pod to see and signal all host processes. These should only be granted to system-level Pods like CNI plugins, node-exporter, or system monitoring agents that require low-level host access. Use Pod Security Standards (restricted/baseline) and RBAC to limit who can create Pods with these flags; combine with securityContext runAsNonRoot and readOnlyRootFilesystem to minimize blast radius. Document the business justification and regularly audit which Pods use these flags, as they significantly increase the blast radius of container compromises.
11. Explain static Pods and their use cases. How do they differ from managed Pods, and what are the operational risks of relying on them in a production cluster?
Static Pods are defined by files on the Node filesystem and created directly by the kubelet without involving the API server; they're commonly used for system components like kubelet, etcd, and kube-apiserver in kubeadm clusters. They differ from managed Pods in that they have no corresponding object in the API server, so kubectl cannot fully manage them, and they cannot use services or be scheduled by the scheduler. The operational risk is that static Pod definitions can drift from the cluster's desired state, making them invisible to monitoring and policy enforcement; kubeadm mitigates this by storing definitions in a well-known location and including them in cluster upgrades, but manual static Pod management is error-prone and should be avoided.
12. A workload requires guaranteed inter-pod communication with sub-millisecond latency within a single node. Design a Pod spec using appropriate namespaces and network plugins. What are the performance and security trade-offs?
Use localhost or loopback communication by placing Pods in the same Pod with multiple containers, or use hostNetwork with careful firewalling, or deploy a high-performance CNI like Cilium in eBPF mode with native routing. Multi-container Pods in the same Pod share a network namespace and can communicate via localhost on different ports with virtually zero latency, but they share resource limits and failure fate. hostNetwork achieves similar latency but exposes all containers to host networking and makes container isolation nearly impossible, increasing security blast radius. For security, prefer multi-container Pods with strict NetworkPolicies and securityContext isolation; use performance profiling to verify the latency requirement is real before accepting these trade-offs.
13. Explain how Pod disruption budgets (PDBs) interact with voluntary and involuntary disruptions. How would you design a PDB strategy for a stateful workload like a database cluster running on Kubernetes, and what are the gotchas when using maxUnavailable vs minAvailable?
PDBs protect Pods during voluntary disruptions (node drains, cluster upgrades) but not involuntary ones (node failures, out-of-memory kills). For a stateful database cluster, you'd typically use minAvailable set to a quorum number (e.g., 2 out of 3 replicas) to ensure majority availability during maintenance. The gotcha is that PDBs only delay eviction—they don't prevent it if the disruption is severe enough, and misconfiguring minAvailable too high can block cluster upgrades entirely. For non-critical workloads, maxUnavailable offers more flexibility by allowing a percentage or count of Pods to be disrupted simultaneously. Always test PDB behavior with actual drain operations in staging to verify your assumptions.
14. A Pod uses a local ephemeral volume (emptyDir) but the Node runs out of disk space. Explain what happens to the Pod, how the kubelet detects this, and what mitigation strategies you would implement at the platform level.
When Node disk space is exhausted, the kubelet triggers a disk-pressure condition and begins evicting Pods in order of QoS class and resource usage; emptyDir Pods without requests/limits are vulnerable. The kubelet monitors disk usage through the eviction manager, which uses thresholds like imagefs.available and nodefs.available to determine eviction necessity. At the platform level, implement strict storage quotas on nodes, use local persistent volumes with proper capacity planning, configure appropriate eviction thresholds in kubelet config, and monitor disk pressure metrics via Prometheus. Additionally, set resource requests and limits on all Pods to improve QoS class placement, ensuring critical workloads have Guaranteed QoS and are evicted last.
15. Design a Pod networking strategy for a multi-tenant platform where tenant A and tenant B must not communicate at the network layer, but both must reach a shared monitoring sidecar. How would you use network policies, namespaces, and Pod labels to enforce this?
Isolate each tenant into separate namespaces (tenant-a, tenant-b) and deploy the shared monitoring sidecar in a dedicated namespace (monitoring). Use NetworkPolicy resources to deny all ingress traffic by default in each tenant namespace, then explicitly allow egress only to the monitoring namespace using label selectors and namespace selectors. The monitoring sidecar should accept connections from both tenant namespaces via a permissive NetworkPolicy. Label Pods in each namespace distinctly (tenant: a, tenant: b) and reference these labels in NetworkPolicy rules to maintain isolation while allowing the specific communication path. This approach ensures strict Layer 3/4 isolation while permitting the required monitoring data collection.
16. A Pod has a sidecar container that performs log rotation and cleanup on a shared volume. The main application container writes logs continuously. Design a container restart policy and probe strategy that ensures the sidecar doesn't disrupt the main container if it crashes, and both containers stay healthy.
Use a Pod spec with restartPolicy: Always to ensure both containers restart independently if they fail, but define a liveness probe only on the main application container, not the sidecar, to prevent cascading restarts. Configure the sidecar with a long terminationGracePeriodSeconds (e.g., 60 seconds) so it can complete cleanup operations before the Pod is terminated. Set readiness probes only on the main container to control traffic routing; the sidecar doesn't need one since it's not serving requests. If the sidecar crashes repeatedly, the kubelet enters crash-loop backoff and restarts with exponential delays, but the main container continues running if its liveness probe passes. Monitor sidecar restart counts separately via metrics to detect persistent issues without affecting application availability.
17. Explain how Kubernetes handles graceful Pod termination (SIGTERM vs SIGKILL). Design a shutdown sequence for a Pod that must drain in-flight requests, close database connections, and persist state before exiting. What kubelet parameters would you tune?
When a Pod is terminated, kubelet sends SIGTERM to all containers and waits for the period defined by terminationGracePeriodSeconds (default 30s) before forcibly killing processes with SIGKILL. For a stateful application, set terminationGracePeriodSeconds to a value that allows your shutdown handlers to complete (e.g., 120 seconds for a database), configure preStop hooks to signal graceful shutdown logic, and implement signal handlers in your application code to flush buffers and close connections on SIGTERM. The kubelet parameter pod-eviction-timeout controls how long a kubelet waits for Pods to gracefully terminate before forcibly evicting them during a drain. Monitor actual shutdown duration in staging to calibrate the grace period accurately, and always include a preStop hook that initiates graceful shutdown independently of application-level signal handling for defense in depth.
18. A Pod is assigned to a Node via nodeSelector, but the selector becomes unsatisfiable after a node label is removed during maintenance. Explain what happens to the Pod and design a platform-level strategy to prevent this scenario in production.
The Pod remains Running on its current Node because nodeSelector only affects scheduling, not enforcement; Kubernetes does not evict Pods whose selectors become unsatisfiable post-scheduling. To prevent this, use Pod Disruption Budgets combined with cluster auto-scaler policies, and implement node affinity with preferredDuringSchedulingIgnoredDuringExecution for non-critical workloads instead of hard requirements. At the platform level, establish label management standards that prevent accidental removal (e.g., immutable labels via admission webhooks or RBAC), use node pools or taints instead of selectors for workload isolation, and implement audit logging to catch label mutations. For critical workloads requiring guaranteed node placement, combine nodeSelector with topology spread constraints and priority classes to handle node churn gracefully.
19. Explain the difference between Pod security standards (PSS) and Pod security policies (PSP). If you had to choose one for a senior platform role managing a large cluster, which would you implement and why?
Pod security policies are cluster-wide admission controllers that enforce security standards at Pod creation time but are deprecated as of Kubernetes 1.25 and removed in 1.28; Pod security standards are simpler label-based policies applied at the namespace level with three profiles (restricted, baseline, privileged) that are easier to manage and understand. For a senior platform role, implement Pod security standards because they offer better maintainability, namespace-level granularity, and alignment with Kubernetes' future direction; you can still enforce restrictive defaults via namespace labels. Use the restricted profile for multi-tenant workloads and baseline for legacy applications, then handle exceptions explicitly via documentation and monitoring rather than complex PSP rules. Combine PSS with a validating webhook for custom security policies that require logic beyond standard profiles, ensuring both compliance and operational flexibility.
20. A Pod requests 1 CPU and 512 MiB memory, but during peak load it spends 90% of time in CPU throttling despite having CPU limit set to 2 CPUs. Explain why this occurs and what metrics you would examine to diagnose the issue.
CPU throttling occurs because the kubelet uses cpu.stat.nr_throttled from cgroups to enforce the CPU limit; if your Pod tries to exceed its limit, the kernel pauses the process, regardless of whether the Node has idle CPU available. The discrepancy between requested (1 CPU) and limited (2 CPUs) means the Pod is only guaranteed 1 CPU, so during overload the scheduler may overcommit the node. Examine metrics like container_cpu_usage_seconds_total, container_cpu_throttling_seconds_total, and node CPU pressure via kube_node_status_pressure to understand throttling frequency and system-wide contention. Increase the CPU request to match actual peak usage (e.g., 1.8 CPUs if throttling indicates consistent demand), review node density and workload distribution, and consider enabling CPU Manager for guaranteed-QoS Pods if sub-millisecond latency is critical.
21. Design a Pod spec that uses a downward API to expose resource limits and node information to the container environment. Explain what information is available through downward API and what is intentionally excluded.
Use the downward API via env and envFrom to expose Pod metadata like namespace, name, UID, labels, and resource limits by referencing fieldRef and resourceFieldRef in the Pod spec; for example, set MEMORY_LIMIT from resources.limits.memory and POD_NAMESPACE from metadata.namespace. The downward API provides Pod-level metadata and resource definitions but intentionally excludes node information like Node name, IP, or resource capacity—use nodeRef or status.hostIP if you need Node details. For sensitive data, avoid exposing secrets through downward API; use mounted secret volumes instead for encryption at rest and access control. This pattern is useful for applications that need to tune themselves based on resource limits (e.g., garbage collector heap sizing in Java), and is commonly used in init containers to validate resource configuration before the main application starts.
22. A Pod is in CrashLoopBackOff state. The container logs show it exited with code 127 (command not found), but you verified the binary exists in the image. What are the possible root causes and how would you systematically debug this?
Exit code 127 typically indicates a missing interpreter or library dependency, not a missing binary; possible causes include a missing shell (if using sh -c in your entrypoint), missing shared libraries (libc, libssl), or incorrect image architecture (AMD64 vs ARM64 mismatch). Debug systematically by running kubectl debug pod to spawn a debug container in the Pod's namespace and verify the binary exists and is executable, then use ldd (on Linux binaries) or otool (on macOS binaries) to check dependencies. Inspect the Dockerfile to confirm the base image includes all runtime dependencies, and verify the entrypoint and command fields in the Pod spec don't introduce shell syntax that requires a shell binary. Use kubectl describe pod to check image pull errors, and review image scan results if using a container registry that performs vulnerability scanning, as some tools may strip or modify binaries during optimization.
23. Design a Pod mutation webhook that automatically injects resource requests, limits, and security context defaults for all Pods in a cluster. What validation should occur after mutation, and what are the failure modes if the webhook becomes unavailable?
Implement a MutatingWebhookConfiguration that targets all Pods and injects reasonable defaults (e.g., 100m CPU request, 128 MiB memory limit, runAsNonRoot: true, readOnlyRootFilesystem: true) based on label-based workload classification. After mutation, apply a ValidatingWebhookConfiguration to ensure injected values meet organization policies (e.g., limits >= requests, no privileged containers), creating a defense-in-depth approach. Configure the webhook with failurePolicy: Ignore to allow Pod creation if the webhook is unavailable, ensuring cluster availability during webhook outages; use sideEffects: None to guarantee idempotency and allow retries. Monitor webhook latency and error rates via Prometheus metrics, implement timeout values (e.g., 5 seconds), and deploy the webhook in a highly available configuration (multiple replicas, Pod disruption budget). Test mutation logic thoroughly in a staging cluster before rolling to production, as buggy mutations can render entire workloads unschedulable or insecure.
24. Explain how the kubelet's device plugin framework enables a Pod to request and use GPUs or other hardware devices. What lifecycle events does a Pod go through when a device is requested, and what happens if a device becomes unavailable after allocation?
The device plugin framework allows vendors (NVIDIA, AMD, etc.) to expose custom devices as extended resources (e.g., nvidia.com/gpu) that Pods can request; the kubelet communicates with device plugins via gRPC to discover devices, allocate them during scheduling, and monitor their health. When a Pod requests a GPU, the scheduler places it on a Node with available GPU capacity, then the device plugin's Allocate method is called before the container starts, allowing the plugin to perform initialization (e.g., setting environment variables, mounting device files). If a device becomes unavailable after allocation (hardware failure, reset), the device plugin signals unhealthy via ListAndWatch, causing the kubelet to mark the Node as NotReady and evict affected Pods with grace period. For critical GPU workloads, implement Pod disruption budgets and pod-to-device affinity via node selectors to control placement, and monitor device health metrics (temperature, errors, power) to proactively replace failing hardware before eviction occurs.
25. A multi-container Pod with an app container and sidecar is experiencing network latency. The sidecar is consuming 80% of the CPU limit, throttling the app container. How would you diagnose and resolve this?
Use kubectl top pod with the --containers flag to confirm CPU distribution between containers; also use kubectl exec to check process-level metrics inside the Pod if top is unavailable. Identify why the sidecar is over-consuming: it might be processing high log volume, running inefficient parsing, or experiencing configuration drift. Increase the sidecar's CPU limit if it's legitimately handling higher load, or optimize its logic (e.g., sampling logs, batching metrics). Alternatively, move the sidecar to a DaemonSet on each node if it's a logging agent, reducing per-Pod overhead. As a platform engineer, implement a monitoring dashboard to surface per-container CPU usage and establish CPU sharing policies or separate resource quotas for sidecars to prevent them from starving app containers.
26. Explain the difference between a Pod's init container, app container, and sidecar container lifecycle. When would you use each in a platform architecture?
Init containers run sequentially to completion before app containers start, making them ideal for setup tasks like downloading configs or waiting for dependencies; app containers run concurrently with other containers in the Pod and represent the primary workload; sidecar containers run alongside app containers for observability, security, or cross-cutting concerns. Init containers ensure prerequisites are met, app containers handle business logic, and sidecars handle operational concerns like logging or metrics collection. For platform engineering, you'd use init containers for certificate provisioning, sidecars for log forwarding to a central system, and app containers for the actual service.
27. A Pod is pending for 15 minutes with status 'Unschedulable' and the event shows 'insufficient memory'. Walk through your debugging approach and how you would resolve this as a platform engineer.
First, verify the actual node memory availability using kubectl top nodes and compare against Pod resource requests; check if the requests are misconfigured or if the cluster genuinely lacks capacity. Review the Pending Pod's resource requests and limits via kubectl describe pod, and check for node selectors, taints, or affinity rules preventing scheduling. As a platform engineer, you would either scale the node pool up, adjust the Pod's requests downward if they're over-provisioned, or redistribute workloads by evicting lower-priority Pods. You should also investigate whether memory pressure exists due to a DaemonSet or system component consuming unexpected resources. Finally, document the incident and consider implementing cluster autoscaling policies or Pod Priority and Preemption to prevent future occurrences.
28. What is a QoS class in Kubernetes, and how do the three classes (Guaranteed, Burstable, BestEffort) affect Pod eviction during node pressure?
QoS classes are determined by the relationship between a Pod's requests and limits for CPU and memory: Guaranteed requires equal requests and limits on all containers, Burstable has requests less than limits or requests without limits, and BestEffort has no requests or limits. During node memory pressure, the kubelet evicts Pods in reverse QoS order: BestEffort Pods are killed first, then Burstable Pods with the highest memory usage relative to their request, and Guaranteed Pods are evicted only when all others are gone. As a platform engineer, you should enforce QoS policies via admission webhooks or Pod Security Standards to ensure critical workloads run as Guaranteed, preventing unexpected evictions. For example, a database Pod should have equal requests and limits, while a best-effort batch job can tolerate eviction.
29. Design a Pod template for a stateless application that must handle graceful shutdown, readiness probes, and cross-zone pod disruption budgets. What are the key configuration decisions?
The Pod should include a preStop lifecycle hook to drain in-flight connections before termination, matching the terminationGracePeriodSeconds (typically 30-60 seconds) to allow graceful shutdown. Implement a readinessProbe using an HTTP endpoint or exec handler to signal when the application can accept traffic, and use initialDelaySeconds appropriately to account for startup time. Define a PodDisruptionBudget with minAvailable or maxUnavailable to protect the application during voluntary disruptions like node upgrades; for stateless services with 3+ replicas, minAvailable: 1 or maxUnavailable: 1 is typical. The Pod should also request appropriate CPU and memory (as Guaranteed or Burstable QoS) and include labels for pod-to-pod affinity spreading across topology zones using topologySpreadConstraints to ensure geographic redundancy.
30. Explain resource requests versus limits in the context of Pod scheduling and runtime behavior. What happens if a Pod exceeds its limit?
Resource requests are used by the scheduler to guarantee sufficient resources on a node before placing a Pod; limits are enforced at runtime by the kubelet to prevent a container from consuming more than specified. If a CPU limit is exceeded, the container is throttled (CPU requests are soft limits), but if a memory limit is exceeded, the container is killed (OOMKilled) because memory is a compressible resource. As a platform engineer, you must size requests conservatively to avoid noisy neighbor problems and set limits high enough to handle traffic spikes without frequent OOMKills. For example, a web server might request 100m CPU and 256Mi memory, with limits of 500m and 512Mi, allowing some burst capacity while preventing runaway consumption.
31. What is a static Pod, and when would a platform engineer configure static Pods instead of relying on Deployments or DaemonSets?
A static Pod is defined by a manifest file on a node's filesystem (typically /etc/kubernetes/manifests/) and is created directly by the kubelet without API server involvement, making it useful for bootstrapping cluster components when the API server is unavailable. Static Pods are commonly used for control plane components like kubelet, kube-apiserver, and etcd to ensure they restart automatically after node reboots. Platform engineers should avoid static Pods for application workloads because they lack the high availability and lifecycle management of Deployments, cannot be easily updated cluster-wide, and are not visible in standard kubectl commands. Static Pods should only be used for critical infrastructure components that must run before the control plane is fully operational.
32. A Pod is stuck in CrashLoopBackOff. Describe your systematic debugging approach, including how to preserve logs and what configurations might cause this state.
CrashLoopBackOff indicates the container crashes, the kubelet restarts it with exponential backoff delays, and the cycle repeats; first, check kubectl describe pod to see the lastState and restart count. Retrieve logs using kubectl logs with the --previous flag to view logs from the crashed container before it restarted; if logs are truncated, increase the log buffer or use kubectl logs --tail=500. Common causes include application errors (check exit codes), misconfigured environment variables, missing dependencies (resolved by init containers), or resource limits causing OOMKills. Configure a postStart lifecycle hook or init container to validate prerequisites, and use a startup probe with a long initialDelaySeconds to differentiate slow startup from crashes. As a platform engineer, implement a centralized logging system to capture logs before Pods are evicted, and enforce Pod Security Policies to catch configuration issues early.
33. How do Pod DNS policies (ClusterFirst, ClusterFirstWithHostNet, None, Host) affect service discovery, and which would you use for a Pod that requires external DNS resolution alongside in-cluster services?
ClusterFirst (default) resolves in-cluster services via kube-dns but forwards external names to the node's resolver; ClusterFirstWithHostNet does the same but for Pods using the host network namespace; None delegates all resolution to dnsConfig, and Host uses the node's /etc/resolv.conf directly. For a Pod requiring both in-cluster and external DNS resolution, use ClusterFirst with a custom dnsConfig specifying additional nameservers or search domains via the dnsConfig field (nameservers, searches, options fields). For example, a Pod might use ClusterFirst to resolve Kubernetes service names internally while adding a corporate DNS nameserver in dnsConfig to resolve internal company domains. As a platform engineer, document DNS policies in your platform documentation and consider using CoreDNS configuration to extend stub zones for hybrid DNS scenarios, avoiding the need for per-Pod dnsConfig overrides.
34. Describe the complete lifecycle of a Pod from creation to deletion, including the role of controllers, the API server, and the kubelet. Where can failures occur?
When a Pod manifest is submitted, the API server validates and stores it in etcd; controllers (like the Deployment controller) watch for Pod creation and manage replicas. The scheduler assigns the Pod to a node by updating the Pod's nodeName field; the kubelet on that node pulls the image, creates the container runtime sandbox, and runs init containers sequentially. Once all init containers succeed, app containers start concurrently; the kubelet monitors container health via probes and reports status back to the API server. During deletion, the kubelet sends SIGTERM to containers and waits for terminationGracePeriodSeconds before sending SIGKILL; the Pod is removed from etcd once all finalizers are cleared. Failures can occur at any stage: validation (bad manifest), scheduling (no available nodes), pulling (image not found), running (application crash), or deletion (finalizer deadlock). As a platform engineer, implement audit logging to track Pod lifecycle events, use webhooks to validate manifests early, and monitor kubelet logs for runtime failures.
35. Your platform needs to run both compute-heavy batch jobs and latency-sensitive microservices on the same cluster. How would you use Pod priority, preemption, and resource quotas to ensure fair resource allocation?
Define two PriorityClasses: one for batch jobs with lower priority (e.g., 100) and one for microservices with higher priority (e.g., 1000); when nodes are resource-constrained, the scheduler preempts lower-priority Pods to make room for higher-priority ones. Use ResourceQuotas per namespace to cap total CPU and memory per workload type, preventing batch jobs from consuming all cluster resources and starving microservices. Combine this with Pod requests and limits such that batch Pods use Burstable QoS (requests < limits) to take advantage of spare capacity, while microservices run as Guaranteed to ensure predictable performance. Implement PodDisruptionBudgets for microservices (minAvailable: 1) so preemption respects availability requirements. As a platform engineer, monitor preemption events and adjust PriorityClass values iteratively based on observed cluster behavior, and consider using Karpenter or cluster autoscaling to add capacity before preemption occurs.
36. A compliance requirement mandates that all Pods must run as non-root users and have read-only root filesystems. Explain how to enforce this platform-wide and identify common application compatibility issues.
Use Pod Security Policies (or Pod Security Standards in newer Kubernetes versions) to enforce runAsNonRoot: true and readOnlyRootFilesystem: true at cluster admission time; apply these policies to all namespaces except system namespaces via admission webhooks. Applications must write logs, temporary files, and caches to an emptyDir volume mounted at a writable path (e.g., /tmp or /var/log); applications requiring write access to their application directory must use an initContainer to copy files to an emptyDir at startup. Common compatibility issues include applications expecting write access to /, applications that hardcode absolute paths to /var or /etc for config, and applications that check runtime capabilities. As a platform engineer, create a standard Pod template with emptyDir volumes pre-configured, provide documentation on required securityContext fields, and test your platform's standard images against these policies before enforcement. For legacy applications that cannot comply, use exemptions sparingly and audit their usage regularly.
37. Explain how Kubernetes handles graceful Pod termination when a node is drained or a Pod is deleted. Walk through the sequence of events including SIGTERM, termination grace period, and SIGKILL. How would you configure a Pod to properly drain in-flight requests before shutdown?
When a Pod is terminated, the kubelet sends SIGTERM to all containers and waits for the duration specified in terminationGracePeriodSeconds (default 30 seconds). During this window, the application should stop accepting new work, drain existing connections, and persist any critical state. If the Pod doesn't exit after the grace period, the kubelet sends SIGKILL to forcefully terminate it. For a production workload, you would set terminationGracePeriodSeconds to a value sufficient for your application's shutdown logic, typically 60-300 seconds, and implement preStop hooks or signal handlers in your application code to orchestrate the graceful shutdown sequence. You can also use a preStop lifecycle hook that calls a shutdown endpoint or script to ensure proper cleanup before the grace period expires.
38. A Pod is assigned to a specific Node using nodeSelector with label 'workload: batch'. During a maintenance window, an operator removes this label from the Node. What happens to the Pod and how would you design a platform-level strategy to prevent Pods from becoming orphaned when node labels are removed?
The Pod will continue running on the Node even after the label is removed, because nodeSelector is only evaluated during Pod scheduling, not during the Pod's runtime. To prevent this scenario, implement a platform policy that uses node affinity with a requiredDuringSchedulingIgnoredDuringExecution rule combined with a webhook that validates label changes, or use a controller that watches for label removal and evicts Pods that no longer satisfy their affinity constraints. Additionally, establish a runbook where label removals are coordinated with Pod eviction using kubectl drain, and consider using Pod Disruption Budgets to control the eviction rate. Another approach is to use a custom controller that reconciles Pod-to-Node affinity and performs controlled evictions when constraints become unsatisfied.
39. Design a Pod networking strategy for a multi-tenant cluster where Tenant A and Tenant B in separate namespaces must not communicate at the network layer, but both must reach a shared monitoring sidecar injected into each Pod. Describe the network policies, namespace configuration, and labeling strategy you would implement.
Create a dedicated monitoring namespace with the sidecar DaemonSet or sidecar injection controller. In each tenant namespace (tenant-a and tenant-b), implement NetworkPolicy resources that deny all ingress and egress traffic by default, then explicitly allow egress traffic only to the monitoring namespace by using namespaceSelector in the egress rules. Label the monitoring pods with a specific label like 'app: monitoring' and reference this label in the egress policy. For sidecar injection, configure the mutating webhook to inject the sidecar only into Pods in tenant namespaces, and ensure the sidecar uses localhost or a loopback address to avoid traversing the network plugin for local communication. This ensures tenant-to-tenant traffic is blocked at the CNI level while both tenants can communicate with the shared monitoring sidecar.
40. A Pod uses an emptyDir volume for temporary data, but the Node runs out of disk space and the kubelet cannot write to the volume. Explain the detection mechanism, what happens to the Pod, and describe three mitigation strategies you would implement at the platform level.
The kubelet periodically checks disk usage through the garbage collector and DiskPressure node condition becomes True when thresholds are exceeded (default 15% free space). When disk pressure is detected, the kubelet may evict Pods, prioritizing those with the lowest QoS class. The Pod using emptyDir will be terminated if it's chosen for eviction. To mitigate this, first implement resource requests and limits on emptyDir volumes using the storage resource quota to prevent runaway disk usage, second configure kubelet's evictionHard and evictionSoft thresholds appropriately based on your workloads, and third implement monitoring and alerting on node disk usage to proactively scale or drain nodes before pressure conditions occur. You can also use local persistent volumes with quota enforcement instead of emptyDir for workloads that require more predictable storage behavior.
41. A Pod has a main application container and a sidecar container that performs log rotation on a shared emptyDir volume. If the sidecar crashes, you want it to restart independently without restarting the main container. Design a container restart strategy, probe configuration, and Pod spec approach that achieves this behavior.
Use a Pod with restartPolicy set to Always, which restarts all containers independently when they exit, ensuring the sidecar restart doesn't affect the main container. Configure a readiness probe on the main application container to verify it remains healthy, and a separate liveness probe on the sidecar that checks the log rotation process is functioning (e.g., by verifying recent rotated log files exist). Set appropriate probe thresholds like initialDelaySeconds: 10 and failureThreshold: 3 for the sidecar to avoid cascading restarts during minor temporary issues. Define the sidecar with a lower resource request than the main container so it doesn't compete for resources. Additionally, use a shared emptyDir volume with a specific mount path for both containers, and ensure the sidecar has a preStop hook that gracefully completes any in-flight log rotation before the kubelet terminates it.
42. Explain the difference between Pod Security Standards (PSS) and Pod Security Policies (PSP). For a senior platform role managing a large cluster with hundreds of workloads, which would you implement and why? What are the operational considerations?
Pod Security Policies (PSP) is the older, admission controller-based mechanism that enforces security constraints at admission time but has a complex evaluation model and was deprecated in Kubernetes 1.25 in favor of Pod Security Standards. Pod Security Standards is a built-in labeling system that applies predefined security levels (Restricted, Baseline, Unrestricted) at the namespace level using labels, evaluated by the PSA (Pod Security Admissions) webhook. For a large cluster, implement Pod Security Standards because they are simpler to reason about, have no performance overhead compared to PSP controllers, are the recommended forward-looking approach, and allow gradual enforcement through audit and warn modes before switching to enforce mode. Operationally, label critical namespaces like kube-system with pod-security.kubernetes.io/enforce: baseline to permit system components while preventing privilege escalation in workload namespaces. Use namespace labels with audit mode initially to identify violating workloads, then gradually transition to enforce mode as teams remediate their manifests.
43. A Pod requests 1 CPU and 512 MiB memory with limits set to 2 CPUs and 2 GiB memory. During peak load, the Pod spends 90% of time in CPU throttling despite the limit being 2 CPUs. The Pod's container count is 1 and it's not sharing the node with other high-CPU Pods. Explain why throttling occurs and describe the metrics and tools you would use to diagnose the root cause.
CPU throttling occurs because Kubernetes enforces the CPU request (1 CPU) as a CFS (Completely Fair Scheduler) quota at the cgroup level, not the limit. The limit of 2 CPUs is a cgroup hard limit, but the request acts as the proportional share. If the node has less than 2 CPUs available or the Pod's quota is throttled relative to other Pods' shares, the application experiences throttling even though it's below the limit. To diagnose, examine metrics like container_cpu_cfs_throttled_periods_total and container_cpu_cfs_periods_total from cAdvisor or Prometheus to quantify throttling, check node CPU allocation using kubectl describe node to verify available allocatable CPU, and review the Pod's actual CPU usage against its request using kubectl top or monitoring dashboards. If the request is indeed constraining the workload, increase the CPU request proportionally, but first verify that increasing the request doesn't cause the Pod to be unschedulable due to insufficient node capacity.
44. Explain ephemeral containers in Kubernetes and their practical use cases in production. What are the security implications, operational constraints, and why would you or wouldn't you enable this feature on a production cluster?
Ephemeral containers are temporary containers launched in running Pods for debugging purposes, useful when a main application container lacks debugging tools like shells or curl. They share the Pod's namespaces (network, PID, IPC) allowing inspection of application state and logs without restarting the Pod. Operationally, ephemeral containers require the EphemeralContainers feature gate to be enabled and kubectl 1.22+, and they run asynchronously without resource limits or probes, potentially consuming unbounded resources. The security implication is that enabling ephemeral containers allows operators to gain arbitrary access to running Pod environments and their shared data, potentially bypassing admission controllers and security policies, so this feature should only be enabled in clusters where operators are fully trusted. In production, consider enabling ephemeral containers in dev/staging clusters for interactive debugging but disable it in highly restricted production clusters, and use alternative approaches like sidecar containers with shell access or centralized logging platforms for production troubleshooting.
45. Design a liveness and readiness probe strategy for a slow-starting web service that requires 90 seconds of initialization before it can accept traffic. Your probe must handle normal operation, rolling updates, and must avoid unnecessary Pod restarts. What specific probe parameters would you set and why?
Use a readiness probe with initialDelaySeconds: 95, periodSeconds: 5, timeoutSeconds: 3, and failureThreshold: 3, ensuring the probe doesn't run until initialization is complete and allows a few transient failures before marking the Pod unready. For the liveness probe, use a higher initialDelaySeconds: 120, periodSeconds: 10, and failureThreshold: 2 to detect deadlocks or hangs only after sufficient warm-up time, and set a longer timeoutSeconds: 5 to avoid false failures from slow responses. This configuration prevents the kubelet from restarting the Pod during the slow startup phase while still detecting failures after the service is healthy. During rolling updates, kubelet respects the readiness probe, so Pods won't receive traffic until ready, preventing request failures. Use a simple HTTP GET probe that checks a dedicated health endpoint returning 200 OK only when fully initialized, avoiding complex shell commands which add latency and are prone to timeout issues.
46. Explain how Pod priority and preemption work in Kubernetes. Design a PriorityClass strategy for a mixed-workload cluster with critical production services, stateful databases, and batch analytics jobs. What priority values, eviction policies, and monitoring would you implement?
PriorityClasses assign numerical priority to Pods; during scheduling, if a Pod doesn't fit, the scheduler attempts to preempt lower-priority Pods to make room. Higher priority values are scheduled first and can evict lower-priority Pods. Create three PriorityClasses: system-critical (1000+) for platform components like DNS and kubelet, production (100-500) for user-facing services and databases, and batch (0-50) for analytics jobs and background work. Assign Pods to appropriate classes based on business impact and recovery time objectives. Configure preemptionPolicy: PreemptLowerPriority on critical PriorityClasses to enable preemption, and set it to Never on batch jobs to prevent them from being evicted. Monitor preemption events using Prometheus metrics like preemption_victims or audit logs, and set up alerts when critical workloads are preempted unexpectedly. Implement Pod Disruption Budgets for production services to ensure they maintain minimum availability even during preemption, and use topologySpreadConstraints to distribute Pods across nodes to reduce blast radius when preemption occurs.
47. A Pod is in Pending state for 30 minutes with no obvious scheduling errors. Walk through a systematic debugging process using kubectl commands and describe what Pod conditions, events, and node metrics would indicate the root cause.
Start by running kubectl describe pod <name> to examine conditions and events; Pending typically means unschedulable. Check the events section for reasons like insufficient CPU, memory, or PVC binding issues. If events are unclear, run kubectl get events --sort-by='.lastTimestamp' to see recent cluster events including scheduler decisions. Inspect the Pod spec with kubectl get pod <name> -o yaml to verify resource requests and nodeSelector constraints. Then check node capacity using kubectl describe node to see allocatable and requested resources; if a Pod requests more CPU/memory than any single node can provide, it will never schedule. Verify PVC status with kubectl get pvc to ensure volumes are bound. Check Pod conditions using kubectl get pod <name> -o jsonpath='{.status.conditions}' to see if PodScheduled or similar conditions show reasons. Finally, examine scheduler logs using kubectl logs -n kube-system deployment/kube-scheduler to see detailed scheduling attempts. If still unclear, check if node selectors or affinity rules are too restrictive by running kubectl get nodes --show-labels and comparing to Pod requirements.
48. Explain how Pod Disruption Budgets (PDBs) interact with voluntary disruptions (rolling updates, node drain) and involuntary disruptions (node failure, resource pressure). Design a PDB strategy for a three-node MySQL cluster running on Kubernetes with strong consistency requirements, and describe the gotchas when choosing minAvailable vs maxUnavailable.
PDBs ensure a minimum number of Pod replicas remain available during disruptions. Voluntary disruptions (evictions triggered by kubectl drain or updates) respect PDBs, while involuntary disruptions (hardware failure) bypass them entirely. For a three-node MySQL cluster with strong consistency, set minAvailable: 2 in the PDB to ensure quorum is maintained during planned maintenance, guaranteeing the cluster remains writable. Avoid maxUnavailable: 1 because it's confusing in small clusters; minAvailable is clearer semantically. A gotcha is that minAvailable doesn't prevent all Pods from being evicted simultaneously during involuntary disruptions, so PDB provides no protection against simultaneous node failures. Another gotcha is that if you set minAvailable: 3 on a three-node cluster, rolling updates will be blocked entirely because the update process cannot evict any Pod. For MySQL, combine PDB with a pod anti-affinity rule to spread replicas across nodes, reducing the blast radius of involuntary disruptions. Monitor disruption evictions using metrics like disruptions_allowed_violations and test PDB behavior in staging by simulating drain operations.

