Software project: Creating a real-life transactional microservices application on Kubernetes
Part 8: OCI DNS config and routes for Istio and testing
In the Part 7 the Gymapp was deployed to OKE (Oracle Kubernetes Engine) with OCI DevOps. Now let’s add the OCI DNS config and Istio routes to access the Gymapp from Internet and then do some basic performance testing.
To make Gymapp microservices to find each other in the Istio env we need to setup ClusterIP services for them in the “otmm” namespace, Gymuser and Gyminstructor below:
kubectl get services -n otmm
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
gyminstructor ClusterIP 10.96.79.63 <none> 8081/TCP 55d
gymuser ClusterIP 10.96.40.188 <none> 8080/TCP 55d
otmm-tcs ClusterIP 10.96.64.73 <none> 9000/TCP 56d
kubectl get services -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-ingressgateway LoadBalancer 10.96.157.172 89.168.122.197 15021:32482/TCP,80:31386/TCP,443:30556/TCP 56d
istiod ClusterIP 10.96.137.164 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 56d
kiali ClusterIP 10.96.215.73 <none> 20001/TCP,9090/TCP 56d
The YAML to create the ClusterIP for Gymuser and Gyminstructor:
apiVersion: v1
kind: Service
metadata:
name: gymuser
namespace: otmm
spec:
selector:
app: gymuser
ports:
- protocol: TCP
port: 8080
name: http-8080
targetPort: 8080
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: gyminstructor
namespace: otmm
spec:
selector:
app: gyminstructor
ports:
- protocol: TCP
port: 8081
name: http-8081
targetPort: 8081
type: ClusterIP
The ClusterIP service “otmm-tcs” in the “otmm” namespace was created as part of the MicroTX install in the previous Part 7.
So was the OCI Load balancer with public IP address “89.168.122.197” for Istio ingress (gateway) and the Kiali ClusterIP in the “istio-system” namespace.
To acces the Gymapp via the OCI Load Balancer in the OKE cluster with URL https://gymapp.devrocks.io/gymuser the OCI DNS zone needs to be added with Load Balancer public IP:
Now let’s add the routes to Istio using Kiali to make the Gymapp UI and REST API’s to work. (The prerequisite is that MicroTX was installed with the Kiali enabled).
Run the istioctl in local dev to start Kiali with the “dashboard kiali” option e.g.
export PATH=$HOME/.istioctl/bin:$PATH
istioctl dashboard kiali
This will start the Kiali in the browser and selecting “Applications” shows:
Using Kiali let’s modify the Gymapp ingress routes by selecting “Istio config” and the “otmm” from the list:
I’ve updated the “spec” part with the following routes:
spec:
hosts:
- '*'
gateways:
- otmm-gateway
http:
- match:
- uri:
prefix: /gym/
route:
- destination:
host: gymuser
- match:
- uri:
prefix: /classes/
route:
- destination:
host: gymuser
- match:
- uri:
prefix: /gymuser/
route:
- destination:
host: gymuser
rewrite:
uri: /
- match:
- uri:
prefix: /gymuser
route:
- destination:
host: gymuser
rewrite:
uri: /gym/
- match:
- uri:
prefix: /instructor/
route:
- destination:
host: gyminstructor
- match:
- uri:
prefix: /signups/
route:
- destination:
host: gyminstructor
- match:
- uri:
prefix: /instructorclasses/
route:
- destination:
host: gyminstructor
- match:
- uri:
prefix: /gyminstructor/
route:
- destination:
host: gyminstructor
rewrite:
uri: /
- match:
- uri:
prefix: /gyminstructor
route:
- destination:
host: gyminstructor
rewrite:
uri: /instructor/
- match:
- uri:
prefix: /payment.html
route:
- destination:
host: gymuser
rewrite:
uri: /payment.html
- match:
- uri:
prefix: /api/v1/xa-transaction
route:
- destination:
host: otmm-tcs
- match:
- uri:
prefix: /metrics
route:
- destination:
host: otmm-tcs
- match:
- uri:
prefix: /health
route:
- destination:
host: otmm-tcs
- match:
- uri:
prefix: /config
route:
- destination:
host: otmm-tcs
- match:
- uri:
prefix: /api/v1/lra-coordinator
route:
- destination:
host: otmm-tcs
rewrite:
uri: /api/v1/lra-coordinator
- match:
- uri:
prefix: /api/v1/tcc-transaction
route:
- destination:
host: otmm-tcs
rewrite:
uri: /api/v1/tcc-transaction
- match:
- uri:
prefix: /admin/v1
route:
- destination:
host: otmm-tcs
rewrite:
uri: /admin/v1
Saved to publish the route changes and then the Gymapp is accessible in browser using the URL https://gymapp.devrocks.io/gymuser:
To do basic performance testing I run loader.io that can run 1 load test for free.
To do this I added the Loader.io key to the Gymapp project as static src/main/resopurces/WEB/loaderio-5549ac7161444d8ec7ae89da3213655e.html file and run thru the Gymuser CI/CD from VS code to re-deploy the Gymuser deployment with the static html.
In order to Loader.io to access this static page (and hence the key) to add the site into it for load testing also the following route needs to be added to the Gymapp Istio config:
- match:
- uri:
prefix: /loaderio-5549ac7161444d8ec7ae89da3213655e.html
route:
- destination:
host: gymuser
rewrite:
uri: /loaderio-5549ac7161444d8ec7ae89da3213655e.html
Now the performance test can be added:
To enable proper authentication IDCS JWT access_token needs to be added as header “Authorization” param.
I run 2 tests:
- Get Myclasses from Gymuser
2. Get Istructorclasses from Gymuser (inter-microservice call)
Results:
- For 500 users over 1 minute, approx. 100 m/s per req for 10 simultaneous clients average.
2. For 500 users over 1 minute, approx. 130 m/s per req for 10 simultaneous clients average. As expected the inter-microservices request took a bit longer to execute.
Kiali also nicely visualizes the microservices calls paths:
Now we have succesfully completed the installation for the Gymapp test env on Kubernetes and run some baseline tests on it.