Skip to main content

Deploy a Java Spring Boot Website to Kubernetes in 5 Minutes with

In this tutorial, we'll build a Spring Boot Java website, configure it for, and deploy it to Kubernetes – all in 5 minutes.


Java is a development environment for building web properties.

If you don't have it already, download and install OpenJDK.

Docker is required to package your backend as a container before deploying to the cloud.

If you don't already have Docker installed as part of your development environment, follow one of the guides below before returning to this quickstart:

kubectl, while not required, is a useful tool for inspecting and managing your deployments in Kubernetes. We recommend following the installation directions for your platform:

Building a Spring Boot website

In this example we'll quickly scaffold a Spring Boot website. You could swap out these steps with use an existing Java web site, or scaffold a site using other frameworks or tools.

  1. Visit

  2. Select these options:

    • Maven
    • Spring Boot v. 2.7.3
    • Package as Jar
    • Java 17

    Note: Jetpack supports all the Spring Boot options, but you'll need to customize your Dockerfile below to match other options.

  3. Click Generate at the bottom.

  4. Unzip the starter website to an empty folder.

Now we have a regular Spring Boot website. Feel free to customize this site to meet your needs.

Configure the App for Containers assumes your web server is running on port 8080 from inside a Docker container. In this section we'll build a Dockerfile to run the web site on port 8080.

  1. Create a new file in the root application folder named Dockerfile and add this content:

    FROM openjdk:17-jdk-alpine
    WORKDIR /app
    COPY . .
    RUN ./mvnw
    ENTRYPOINT ["java","-jar","build/libs/site.jar"]

    Note: this is a bare-bones Dockerfile. Depending on your app's dependencies and Java SDK version, you may need to customize this or add more.

Initialize the project with needs some initial configuration to understand the Spring web server. We need only do this once per website.

  1. To install the Jetpack CLI, open a terminal and run

    curl -fsSL | bash

    Jetpack CLI works on Linux, macOS, and on Windows via WSL2.

  2. Login to Jetpack CLI:

    jetpack auth login

    Logging into Jetpack allows you to deploy to the Kubernetes cluster. You can also run on your own cluster in your Azure, AWS, GCP, or private cloud account.

  3. Initialize the project for Jetpack:

    jetpack init

    This wizard interviews you and configures the Jetpack deployment strategy to match your application.

  4. Answer that Yes, this is a web server. This tells Jetpack that we want to accept inbound traffic.

    If we were building a scheduled cron job or a function that drained a queue, we could answer no.

  1. Finish the wizard, and Jetpack CLI automatically generates an appropriate jetconfig.yaml file. You should commit this to source control.

Deploy to Kubernetes using

Now that the project is configured for Jetpack, deploying is really easy.

  1. Open a terminal in the directory with the Dockerfile and jetconfig.yaml file.

  2. Deploy to Kubernetes:

    jetpack dev

    Now Jetpack makes the deployment really simple. Automatically it will:

    • Build the Docker image
    • Push the image to a private registry
    • Schedule the necessary Kubernetes resources
    • Create a publicly routable URL to test the website
    • Setup port-forwarding from your local machine
    • Stream application logs back to the terminal
  3. Test the website:

    In the console output will be the publicly routable URL. Click this URL to view the web page.

    Jetpack also sets up port-forwarding, so you can also browse to http://localhost:8080/ to view the page.

Next Steps

It's easy to deploy a Java Spring Boot website to Kubernetes with In this tutorial we scaffolded a website, configured it for, and used to deploy to Kubernetes. is a great zero-DevOps solution for deploying to Kubernetes. Visit to learn more and to start deploying your content to Kubernetes with ease.