Deploy a Spring Boot App
Ship your Spring Boot API without managing JVM servers.
Overview
Spring Boot is the dominant Java framework for building production-grade microservices and REST APIs. Kubeletto runs your Spring Boot JAR in a containerized JVM, manages TLS and routing externally, and scales instances to zero when traffic drops — ideal for internal APIs and staging environments.
Prerequisites
- A Spring Boot project with Maven or Gradle
- application.properties or application.yml reading from environment variables
- A Kubeletto account
Step-by-Step Guide
Deploying Spring Boot to Kubeletto is done by configuring a Dockerfile, connecting your GitHub repository, and setting environment variables. Follow this step-by-step checklist to deploy your code:
- 1
Create a Dockerfile
Use a multi-stage build to compile and package a minimal JRE runtime.
dockerfileFROM maven:3.9-eclipse-temurin-21 AS builder WORKDIR /app COPY pom.xml . RUN mvn dependency:go-offline COPY src ./src RUN mvn package -DskipTests FROM eclipse-temurin:21-jre-alpine WORKDIR /app COPY --from=builder /app/target/*.jar app.jar EXPOSE 8080 ENTRYPOINT ["java", "-jar", "app.jar"] - 2
Read config from environment
Spring Boot reads environment variables automatically for property overrides.
properties# application.properties spring.datasource.url=${DATABASE_URL} spring.datasource.username=${DB_USER} spring.datasource.password=${DB_PASS} server.port=${PORT:8080} - 3
Deploy to Kubeletto
Set your database credentials and deploy.
bashkubeletto env set DATABASE_URL=jdbc:postgresql://host:5432/dbname --app spring-app kubeletto env set DB_USER=user --app spring-app kubeletto env set DB_PASS=password --app spring-app kubeletto deploy --source github --repo your-org/spring-app --branch main
Sample Environment Variables
To configure your Spring Boot application, set these key-value pairs in the environment variables tab of the Kubeletto console or CLI. Ensure production secrets are flagged as write-only:
SERVER_PORT=8080
DATABASE_URL=jdbc:postgresql://host:5432/dbname
DB_USER=myuser
DB_PASS=mypassword
SPRING_PROFILES_ACTIVE=production
JAVA_TOOL_OPTIONS=-Xmx512m Related Kubeletto Features
Kubeletto offers automatic SSL certificate provisioning, zero-downtime rollbacks, and scale-to-zero autoscaling for Spring Boot container workloads:
PaaS Platform Comparisons
See how Kubeletto compares directly against other cloud platforms and PaaS providers when deploying Java workloads:
Frequently Asked Questions
Find direct answers to common questions about hosting, building, scaling, and managing Spring Boot containerized apps on Kubeletto:
How do I tune JVM memory for containers?
Set JAVA_TOOL_OPTIONS=-Xmx512m to cap heap usage. Kubeletto enforces a container memory limit, so always set -Xmx below the limit to avoid OOMKill.
Does Spring Boot Actuator work on Kubeletto?
Yes. Expose actuator on a separate management port or path and use it for health checks. Kubeletto's ingress routes all traffic to your main server.port.
Can I use GraalVM native image with Kubeletto?
Yes. Build a native image with GraalVM in your multi-stage Dockerfile. The resulting binary starts in milliseconds, making it ideal for scale-to-zero deployments.
More Deploy Guides
Deploy your Spring Boot app today
Free during our active beta. No credit card required.
Start Deploying Free