Difficulty: Intermediate
Estimated Time: 20 minutes

Here's an example of some microservices using Spring projects and Astra!

In this scenario, we'll learn how to:

  • Create a Kubernetes cluster using KinD
  • Create a Spring Boot microservice with direct Cassandra access
  • Create a Spring Data microservice using Spring Data Cassandra and Spring Data REST
  • Create a gateway microservice using Spring Cloud Gateway

This example is an inventory application that includes Products and Orders. Here's the architecture: Application architecture

This scenario is based on the example found here. For an explanation of the example check out this article.


NOTE: Astra already provides a REST interface, so why create an example of a Spring REST services? So you can easily adapt these examples to other Cassandra clusters. We used Astra here to reduce the load on the Katacoda VM. Check out the example repo for more details.


ver 0.004

In this scenario, we learned how to:

  • Create a Kubernetes cluster using KinD
  • Create a Spring Boot microservice with direct Cassandra access
  • Create a Spring Data microservice using Spring Data Cassandra and Spring Data REST
  • Create a gateway microservice using Spring Cloud Gateway

Remember, you can find the code for the full example here. For an explanation of the example check out this article.

Build a Simple Spring Boot REST Microservice

Step 1 of 5

Create a Kubernetes Cluster

In this step, we'll create a Kubernetes cluster consisting of the master node, some worker nodes.


NOTE: In this scenario, we are simulating a full Kubernetes cluster running a Cassandra cluster and several Spring microservices all on a Katacoda VM! This is a significant load, so some of the steps may take some time to complete. Please be patient.


We'll use KinD to create the Kubernetes cluster named spring-boot-cluster.

What is KinD?

KinD is Kubernetes running inside a Docker container. As you know, most people use Kubernetes to manage systems of Docker containers. So, KinD is a Docker container that runs Kubernetes to manage other Docker containers - it's a bit recursive.

We use KinD so we can create a many-node Kubernetes cluster on a single machine. KinD is great because it's relatively light-weight, easy to install and easy to use.

We've already installed KinD for you. For your reference, here are the commands we used to install KinD.

curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64 chmod +x ./kind mv ./kind /usr/local/bin/kind

kind create cluster --name spring-boot-cluster --config kind-config.yaml

Your cluster should be up and running. Let's take a look.

kubectl get nodes

NOTE: It may take a minute for the nodes in the Kind Cluster to be Ready. You can re-run the previous command until they are, or just continue on with the next step. The nodes will be ready when we need them.


Congratulations! You have a Kubernetes cluster!