gRPC Microservices (Spring Boot + Java) with Kubernetes and Docker on AWS EKS & K3s (Lightweight Kubernetes)
This is a complete template project for demo purposes, using the latest technologies with deployment tools.
It shows how to
- use lightweight communication protocol to communicate between micro-services like gRPC using Spring Boot and Java;
- package a Spring Boot application into a Docker image, using Skaffold and Google Jib;
- Deploy it into your Kubernetes cluster.
You will need the following in your system:
- Skaffold 1.33.1 or better
- Kubectl 1.22.0 or better
- Docker registry (for me i use Github https://ghcr.io)
- a local Kubernetes cluster like Docker for Desktop CE or K3s if you want to develop with your local cluster, here you can find simple script to run k3s cluster multi-nodes with istio using Multipass.
(Note: if you want to work directly with your remote AWS cluster, having a local cluster is not strictly needed but strongly advised!)
This builds and pushes a container image for your application to a container registry. If you encounter authentication issues, see Authentication Methods .
./gradlew jib
(Note: please put your registry info in gradle.properties " registryName", "registryUser", "registryPassword" :))
First you must configure your cluster to use Container Registry if you are using a private registry *Good Article As example ( Github Registry):
kubectl create secret docker-registry my-ghcr \
--docker-server=ghcr.io \
--docker-username=dummy \
--docker-password=dummyToken \
--docker-email=dummy@dummy.com \
--namespace=default
You code in your IDEs and deploy/run explicitly by typing:
skaffold run --port-forward # to test call `curl http://127.0.0.1:5000/grpc-client/users`
(Note: Istio gateway are exposed to port 80 with /api prefix your url it will look like this http: //{YourClusterIp}/api/grpc-client/users )
Happy coding!
skaffold delete