Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 2.76 KB

File metadata and controls

72 lines (52 loc) · 2.76 KB

Sample Apps using the OpenAPI Route Definition Locator

Here you can find an example of running two microservices behind a Spring Cloud Gateway using the OpenAPI Route Definition Locator in a Kubernetes cluster. This example includes Grafana dashboards for monitoring the OpenAPI Route Definition Locator.

Prerequisites

Install the following software. Make sure their installed binaries are in your $PATH.

  1. Kubernetes (e.g. via Docker Desktop)
  2. Helm
  3. Task

For a nice terminal based user interface to manage your Kubernetes cluster, you may want to install k9s.

Build and Deploy

Run in your shell:

cd sample-apps
task build deploy

See the troubleshooting tips if the Helm deployments fail.

After the deployment succeeded you will see output like this:

API Gateway:
  Base URL: http://api.127.0.0.1.nip.io

  Try:
    curl -v http://api.127.0.0.1.nip.io/users | jq .
    curl -v http://api.127.0.0.1.nip.io/users/6ac8d69c-7a8c-4ce3-854a-2a51f8bbd868 | jq .
    curl -v http://api.127.0.0.1.nip.io/users/6ac8d69c-7a8c-4ce3-854a-2a51f8bbd868/orders | jq .
    curl -v http://api.127.0.0.1.nip.io/users/6ac8d69c-7a8c-4ce3-854a-2a51f8bbd868/orders/271acbc1-50b0-45ae-ad04-a231f1057714 | jq .
    curl -v http://api.127.0.0.1.nip.io/actuator/gateway/routes | jq .

Grafana:
  URL              : http://grafana.127.0.0.1.nip.io/
  Login credentials: admin // admin
  Gateway Dashboard: http://grafana.127.0.0.1.nip.io/d/c09a9f35
  Service Dashboard: http://grafana.127.0.0.1.nip.io/d/179dd90b

API Requests via API Gateway

You can send some API requests via the API gateway to the example services:

curl -v http://api.127.0.0.1.nip.io/users
curl -v http://api.127.0.0.1.nip.io/users/6ac8d69c-7a8c-4ce3-854a-2a51f8bbd868
curl -v http://api.127.0.0.1.nip.io/users/6ac8d69c-7a8c-4ce3-854a-2a51f8bbd868/orders
curl -v http://api.127.0.0.1.nip.io/users/6ac8d69c-7a8c-4ce3-854a-2a51f8bbd868/orders/271acbc1-50b0-45ae-ad04-a231f1057714

Grafana Dashboards

There are Grafana dashboards you can look at. Open http://grafana.127.0.0.1.nip.io/. Login with the credentials admin / admin.

There is a Spring Boot Dashboard and a Spring Cloud Gateway Dashboard.

Troubleshooting

The Helm deployment of kube-prometheus-stack may fail if you have incompatible versions of the CRDs created by this chart installed in your Kubernetes cluster. Run task clean to have them deleted. Then run task deploy again.