-
JDK17 - If you have sdkman and have installed temurin 17.0.5-tem then you can just run
sdk env(This project already has an sdk env initialisation config file) to activateTemurin 17.0.5. -
Docker Desktop (or) Rancher Desktop (or) Colima
-
minikube installed
-
Istio installed
-
grpCurl is installed (This is just for testing needs)
-
The command
docker psworks fine (This is to just test if docker is up and running properly) -
minikube add-ons enabled using the commands:
minikube addons enable dashboardminikube addons enable metrics-server
-
gRPC benchmarking and load testing tool is installed.
- Start minikube using the command
minikube start --cpus 6 --memory 8192everytime you delete your deployment and trigger a fresh one so that the request reaches your k8s cluster) - Install istio on your k8s cluster via
istioctl install - Install all the istio default addons via
kubectl apply -f ~/tools/istio/istio-1.16.1/samples/addons(Here we are assuming that the istio installation directory is~/tools/istio/istio-1.16.1). This will help us view the Kiali, Grafana, Prometheus, Jaegar dashboards. - Install the otel collector (Open Telemetry Collector) by running
kubectl apply -f deploy/otel-collector-config.ymlThis will ensure that our distributed tracing works fine. - Create a namespace (This is where our apps will be deployed) via
kubectl create ns rationale-emotions. For additional details read at the bottom. - Enable Envoy proxy auto injection via Istio:
kubectl label ns rationale-emotions istio-injection=enabled - Setup minikube docker daemon for accessing our locally built image:
eval $(minikube -p minikube docker-env) - Build the docker images using
./mvnw clean package -Dquarkus.container-image.build=true - Once the images have been built now deploy the images into kubernetes using the shell script
./install-to-k8s.sh rationale-emotions(Hererationale-emotionsis our namespace) - Open up the tunnel in a new terminal using
minikube tunnel(Remember to kill this and restart this, - Now you can open up an RPC client such as grpcurl (or) BloomRPC and then interact with the service. Try accessing the end point
com.rationaleemotions.generated.DashboardService.dashBoardDetailswith the username asrajnikanth - Remember to run (8) in the same terminal wherein you ran (7)
- If you would like to delete our app, run the shell script
./delete-from-k8s.sh rationale-emotions - If you would like to generate the kubernetes manifest files (Yes, Quarkus lets you generate them too!!!) then you can do it using
./mvnw clean package - To view the Jaegar dashboard you can run
istioctl dashboard jaeger(In a new terminal because this should be running)
Here's an example of how a grpcurl invocation looks like
grpCurl Example
➜ microservices git:(main) grpcurl -d '{"userName":"rajnikanth"}' --plaintext \
--import-path dashboard-app/src/main/proto \
--proto dashboard-app/src/main/proto/dashboard.proto \
localhost:10030 com.rationaleemotions.generated.DashboardService/dashBoardDetails
{
"basicDetails": {
"username": "rajnikanth",
"fullName": {
"firstName": "Sivaji",
"lastName": "Rao"
},
"emailAddress": "[email protected]"
},
"favoriteMovies": [
{
"movieId": 31,
"language": "tamil",
"movieName": "b3d03050-76d7-40bb-a40b-536061bf3f6e",
"durationInMins": 73
},
{
"movieId": 32,
"language": "tamil",
"movieName": "e90bb8b8-6269-476e-b233-f9015362ec0f",
"durationInMins": 51
}
],
"recentlyWatchedMovies": [
{
"movieId": 301,
"language": "tamil",
"movieName": "e578fb45-4871-4ad6-984c-c7312e690800",
"durationInMins": 18
},
{
"movieId": 302,
"language": "tamil",
"movieName": "9b9edd74-26de-45fe-a757-277a486e09f3",
"durationInMins": 1
}
]
}There are some useful shell scripts created.
install-to-k8s.sh- Allows you to install our demo microservices to a namespace of your choice. Invoke using./install-to-k8s.sh my-fancy-namespacedelete-from-k8s.sh- Deletes whatever demo microservices you installed via (1). Invoke using./delete-from-k8s.sh my-fancy-namespacefire.sh- Generates one request against our demo dashboard.generate_load.sh- Generates a load for 1 minute against our demo dashboard.
istioctl dashboard jaeger- Opens up the Jaegar UIistioctl dashboard- Tells you what other things you can open up.minikube dashboard- Opens up the Minikube dashboard which shows the internals of the k8s cluster.
There are essentially two ways in which one can deal with namespaces viz.,
- When applying a manifest file (You will find the apply commands in the
install-to-k8s.shscript) using the-n <namespaceNameGoesHere>option in thekubectl applycommand. - In the Quarkus application configuration file
src/main/resourcs/application.propertiesvia the parameterquarkus.kubernetes.namespace
In this demo project, I have chosen to go with (1).
- What is OpenTelemetry? A Straightforward Guide
- Distributed Tracing with OpenTelemetry Collector on Kubernetes – Part 1
- You can find additional instructions in this gist of mine