Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Spring Boot on Kubernetes

The purpose of this example is to demonstrate the following:

  • How you can use the kubernetes-spring-stater.
  • How dekorate detects that this is a web app and automatically configures services and probe.
  • How you can end-to-end test the application.
  • How you can trigger a docker build after the compilation.

The application is using:


Which contains all the required modules, including the annotation processors that detect spring web applications.

The Main.class is annotated with @KubernetesApplication which triggers the resource generation. It's also annotated with @EnableDockerBuild. This annotation allows the user to trigger a docker build after the compilation, by passing the system property to the build for example:

mvn clean install

Note: Dekorate is not going to generate a Dockerfile for you. It expects to find one in the root of the module and it also expects to find the docker binary pointing to a running docker daemon.

The spring web application processor will detect our, and will:

  • add container port 8080
  • expose port 8080 as a service
  • add readiness and liveness probes.

Integration testing

For the purpose of integration testing it includes:


This annotation will bring in the junit5 extension that dekorate provides, that allows you to run integration tests via the '@KubernetesIntegrationTest' annotation. The integration test is and it demonstrates:

  • how you can deploy the application for end to end testing
  • how use can use the kubernetes client from within the test to connect to the application.

The test are going to be automatically run when building the application. For example:

mvn clean install

Note: To run the integration tests an actual kubernetes environment is required. As the integration test requires a docker build to run, the tests will only run if an existing Dockerfile is found, and if the docker daemon used is the one use by kubernetes.

You can’t perform that action at this time.