Blindfolded debugging…​ Not today!!

15 MINUTE PRACTICE

The Mysterious Application in your developer environment is now up and running. It is composed of several components, but so far, you have no clue about how the application is working. Going all over this application and debugging it completely blindfolded is time consuming and a crazy bid.

Red Hat OpenShift Container Platform provides services to get observability of applications and to understand how different components are interacting with each other.

What is Kiali?

Kiali

A Microservice Architecture breaks up the monolith into many smaller pieces that are composed together. Patterns to secure the communication between services like fault tolerance (via timeout, retry, circuit breaking, etc.) are needed as well as distributed tracing to be able to see where calls are going.

A service mesh can now provide these services at a platform level and free the developer from those tasks. Routing decisions are done at the mesh level.

Kiali works with Istio, in OpenShift or Kubernetes, to visualize the service mesh topology, to provide visibility into features like circuit breakers, request rates and more. It offers insights about the mesh components at different levels, from abstract Applications to Services and Workloads.

Kiali, please tell me, how is this application working?

Kiali provides an interactive graph view of your namespace in real time, being able to display the interactions at several levels (applications, versions, workloads), with contextual information and charts on the selected graph node or edge.

Click on the 'Developer Observability' button below

Then, log in with OpenShift as user%USER_ID%/%OPENSHIFT_PASSWORD%'

Kiali- Log In

In the 'Graph' view, enter the following configuration:

Table 1. Graph Settings
Parameter Value

Namespace

staging-project%USER_ID%

Type Graph

Versioned app graph

Display

'Traffic Animation' checked

Hide

node = unknown OR service*=PassthroughCluster

The outcome is a graph with all the services, connected by the requests going through them. You can see how the services interact with each other.

Kiali- Graph

In order to get the previous screen, you need to generate traffic. Please reload the Web UI several times!

Even if the application seemed working fine, please compare the all Services you have between the OpenShift Console and the Kiali Graph.

Have you found the one difference? Great! Let’s investigate!

This is a database missing from the Kiali Graph…​

Check the Catalog Service Configuration

You clearly see that the Catalog PostgreSQL Service is not a part of the Kiali graph. That means this service is not called by the Catalog Service as it should be.

In the OpenShift Web Console, from the Developer view, click on 'ConfigMaps' > 'catalog'.

Che - OpenShift Create Config Map

Take a look at the Data Section. Catalog Service is configured with the development parameters. Indeed, it is currently configured with an InMemory Database (H2), which is used for development purposes only.

OpenShift - Catalog ConfigMap H2

This is the reason why the Catalog PostgreSQL Service is not currently using.

Fix the issue

Let’s change the configuration to connect the Catalog Service to the PostgreSQL database.

Click on the tab 'YAML' of the 'CM catalog' and update the content as follows:

data:
  application.properties: |
    spring.application.name=catalog
    server.port=8080

    spring.datasource.url=jdbc:postgresql://catalog-postgresql:5432/catalogdb(1)
    spring.datasource.username=catalog
    spring.datasource.password=catalog
    spring.datasource.driver-class-name=org.postgresql.Driver(2)
    spring.jpa.hibernate.ddl-auto=create
    spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
1 PostgreSQL JDBC URL
2 PostgresSQL driver

The result should look like as follows:

OpenShift - Update Configmap

Then, click on 'Save'.

Now, you have to re-deploy the Catalog Service with the latest configuration. Go back to 'Topology', click on the 'DC catalog-v1' bubble and select 'Start Rollout' action

OpenShift - Catalog Rollout

Once the application is up and running, refresh your browser opened on the Coolstore Application and visualize the change on the Kiali graph.

Kiali- Graph with DB

You survived and you put off the blindfold on your own. But it is not THE END …​

Now, let’s go deeper!!