Scrivio Interview library

Containers and Kubernetes

25 questions in 7 subtopics.

JVM in containers

ConceptFoundations6 min read
A Spring Boot service runs in a container with a 2 GiB memory limit and no JVM flags. How does the JVM pick its heap size, and why might it be either too small or too large?
DebuggingIntermediate7 min read
A Java pod restarts several times a day with exit code 137 and reason OOMKilled, but heap usage in metrics never exceeds 60 percent of -Xmx. How would you investigate?
LeadershipAdvanced6 min read
Your fleet runs 2,000 Java containers with inconsistent JVM flags copied between teams. How would you set and roll out standard JVM container settings?
LeadershipPrincipal6 min read
The company spends a large share of its cloud budget on memory for JVM containers. As the senior technical leader, how do you decide between tuning the existing fleet, adopting newer JDK features, moving some services to native images, or rewriting hot services in another language?

Container images for Java

ConceptFoundations6 min read
Compare building a container image for a Spring Boot app with a simple Dockerfile copying the fat jar, with layered jars, and with Cloud Native Buildpacks via spring-boot:build-image.
DebuggingFoundations6 min read
A Spring Boot container works on a developer's laptop but fails in the cluster with 'exec format error'. Another image fails with permission denied writing to /tmp. Explain both.
DesignIntermediate7 min read
You need to reduce container image size and startup time for 30 Spring Boot services. What options do you have and what do they cost?
DesignAdvanced6 min read
Your security team requires all Java images to be rebuilt within 48 hours of a critical CVE in the base image or JDK. Design the image supply chain for 200 services.

Health probes

ConceptFoundations6 min read
Explain liveness, readiness and startup probes in Kubernetes and how Spring Boot Actuator supports them.
DebuggingIntermediate6 min read
During a database outage, all pods of a Spring Boot service were restarted repeatedly by Kubernetes, making recovery slower. The liveness probe pointed at /actuator/health. What went wrong?
DesignAdvanced6 min read
Define the health probe standard for all Spring Boot services on your Kubernetes platform, including what each probe may check and the default timings.

Graceful shutdown

ConceptFoundations6 min read
What happens when Kubernetes stops a Spring Boot pod during a rolling deployment, and how do you make in-flight requests finish?
ScenarioIntermediate7 min read
A Spring Boot service consumes Kafka messages and also runs a long batch export. During deployments, some messages are processed twice and exports are left half-written. How would you make shutdown safe?
LeadershipAdvanced6 min read
Your error budget reports show that every deployment across 100 services causes a short spike of 5xx errors. How would you eliminate this across teams?

Resource limits

ConceptFoundations7 min read
Explain Kubernetes CPU requests and limits and what CPU throttling looks like for a Java service.
ScenarioIntermediate7 min read
A latency-sensitive Spring Boot API has p99 spikes every few seconds. The pod has a CPU limit of 1 and requests of 0.5. GC logs show short pauses. What is happening and what would you change?
LeadershipAdvanced7 min read
Your cluster costs are rising and utilisation is around 20 percent, mainly due to Java services with large requests. How would you lead a right-sizing effort across teams?
LeadershipPrincipal7 min read
As the senior technical leader, you must set a company-wide policy for Kubernetes resource requests and limits and JVM sizing for 1,500 Java services. Teams argue for large safety margins; finance wants high utilisation. How do you set and govern the policy?

Autoscaling

ConceptFoundations6 min read
Explain how a Horizontal Pod Autoscaler scales a Spring Boot service on CPU and why JVM warmup can cause problems.
DesignIntermediate6 min read
A Spring Boot service consumes orders from Kafka with large daily spikes. CPU-based HPA reacts too late. Design an autoscaling approach.
LeadershipPrincipal6 min read
Your company is deciding whether to keep running Java services on self-managed Kubernetes clusters or move to a managed serverless container platform. As the senior technical leader, how do you evaluate this over several years?
LeadershipPrincipal6 min read
Your traffic has strong daily and seasonal peaks, and the platform keeps enough Java pods for peak load all day. As the senior technical leader, how would you decide the autoscaling strategy and how much to invest in faster JVM startup to support it?

Docker CLI basics

ConceptFoundations6 min read
Explain what these Docker commands do and when you would use each: docker build -t orders:1.2 ., docker run -d -p 8080:8080 --name orders -e SPRING_PROFILES_ACTIVE=dev orders:1.2, docker logs -f orders, docker exec -it orders sh, docker ps -a, docker image ls, docker rm -f orders.
DebuggingFoundations7 min read
A Spring Boot container exits immediately after docker run. docker ps shows nothing, and the app works when started with java -jar on the laptop. Which Docker commands would you use to find the cause, and what are the common reasons?
ScenarioIntermediate7 min read
During an incident, a Java container in a Docker host (not Kubernetes) uses 100 percent CPU and responds slowly. Using only Docker CLI and JDK tools, how would you gather evidence without restarting it?