How would you structure a Kubernetes Deployment for a Spring Boot application with 2 replicas, resource requests/limits, and a readiness probe on the health endpoint?
💡 Model Answer
A typical Deployment YAML for a Spring Boot app might look like the snippet you provided. You would set spec.replicas: 2 to run two pods for high availability. Under spec.template.spec.containers, you would specify resource requests and limits, e.g., requests: {cpu: '500m', memory: '512Mi'}, limits: {cpu: '1', memory: '1Gi'}. The readinessProbe would be an HTTP GET to the /actuator/health endpoint, with initialDelaySeconds: 30, periodSeconds: 10, timeoutSeconds: 5, failureThreshold: 3. This ensures traffic is only sent to pods that are fully started. You might also add a livenessProbe to restart pods that become stuck. The Deployment ensures that Kubernetes automatically manages scaling, rolling updates, and self-healing. You can also use a rolling update strategy with maxUnavailable: 1 to ensure one pod is always available during updates.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500