A Spring Cloud Gateway with Kubernetes support
This is a simple edge server using the new spring cloud gateway.
The gateway could be run locally or expose in a kubernetes cluster.
First, you need to have running the Eureka on your computer, for example the provided by the Eureka Server.
Then, you need some microservices running in eureka, such the provided by the Simple Microservice
Finally, start the gateway with:
$ mvnw spring-boot:run
You could invoke any server in eureka in the format off http://localhost/NAME-IN-EUREKA/method
, for example:
$ curl http://localhost/simplemicroservice/hello
First you need to compile this project:
$ mvnw clean package
Before continue you need to have your local registry running on the cluster:
Then, build the docker image and push it to a local registry
$ docker build . -t gateway
$ docker tag gateway localhost:5000/gateway
$ docker push localhost:5000/gateway
And finally add it to the kubernetes cluster with:
$ kubectl create -f gateway-deploy.yml
Now we could invoke the Microservice in with:
$ minikube service gateway
and change the url to http://service-url/NAME-IN-EUREKA/method
, for example:
$ curl http://192.168.99.100:30418/simplemicroservice/hello