Skip to content

Spring Starter Project with Skaffold + Dekorate

License

Notifications You must be signed in to change notification settings

kubeopsskills/spring-starter-skaffold-dekorate

Repository files navigation

Spring Starter Project with Skaffold + Dekorate

This is a boilerplate template for building / deploying a Spring microservice on Kubernetes using Skaffold + Dekorate.

Versioning

GitHub Release JDK Version Spring Boot Version Spring Cloud Version Skaffold Version Dekorate Version Jib Version
master 15 2.3.4.RELEASE Hoxton.RELEASE 1 0.13.2 2.6.0

Project Structure

├── README.md
├── manifests
├── mvnw
├── mvnw.cmd
├── pom.xml
├── skaffold.yaml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── guru
│   │   └── resources
│   │       ├── application-kubernetes.yaml
│   │       ├── bootstrap.yaml
│   │       ├── static
│   │       └── templates
│   └── test
│       └── java
│           └── guru
└── target
  • manifests folder will contain Kubernetes manifests generated by Dekorate
  • skaffold.yml is the Kubernetes pipeline
  • src/main/java folder will contain Spring Java classes
  • src/main/resources folder will contain Spring bootstrap (bootstrap.yaml) config and Dekorate config (application-kubernetes.yaml)
  • target folder will contain Spring JAR file

Setting Up

To setup this project, you need to clone the git repo

$ git clone https://github.com/kubeopsskills/spring-starter-skaffold-dekorate.git
$ cd spring-starter-skaffold-dekorate

followed by

$ mvn clean install

Deploying a Spring microservice

Preparing RBAC for Spring microservice

$ git clone https://github.com/kubeopsskills/spring-starter-skaffold-dekorate-config.git
$ cd spring-starter-skaffold-dekorate-config

followed by

$ kubectl apply -f rbac

Preparing Config Map for Spring microservice

$ kubectl apply -k config

To enable Continuous Development (Develop + Integrate Source Code From IDE) on Kubernetes, run following command:

$ skaffold dev -p dev -n [namespace]

This will build the project source code to Docker image and then deploying it on Kubernetes with forwarding logs from Kubernetes to your IDE!