Kubernetes Native Java with Spring Boot

Demonstration of:

  • Cloud native development with Spring Boot and Reactive Spring
  • Containerization with Cloud Native Buildpacks
  • Kubernetes deployment manifests, graceful shutdown, and health probes
  • Spring Boot configuration through ConfigMaps
  • Native executables with Spring Boot 3 and GraalVM
  • Serverless applications on Knative

Prerequisites

To run all the examples, you need to install the following tools:

Recommended tools:

Usage

Both Spring Boot applications can be run locally with this command:

$ ./gradlew bootRun

You can containerize them via Buildpacks. Book Service will be containerized as a JVM image, whereas Book Native will be containerized as a native image.

$ ./gradlew bootBuildImage

Deployment on a local Kubernetes cluster

You can spin up a Kubernetes cluster as follows:

$ ./kind/create-cluster.sh

Then, deploy Book Service with kubectl:

$ kubectl apply demo-service/config

When you're done, you can destroy the cluster as follows:

$ ./kind/destroy-cluster.sh

Deployment on a local Kubernetes cluster with Knative

You can spin up a Kubernetes cluster with Knative as follows:

$ ./kind/install-knative.sh

Then, deploy Book Native with kubectl:

$ kubectl apply demo-service/knative