What is the best approach to monitor telemetry events from Spring Boot application which runs in a minikube cluster?

1/12/2022

I am looking for a way to monitor metrics from my Spring Boot application which runs in a minikube cluster to in an Azure portal. So far for the demo I have built a telemetry as follows and connected my application to Application Insights in Azure:

TelemetryClient telemetryClient = new TelemetryClient();
MetricTelemetry telemetry = new MetricTelemetry();
telemetry.setTimestamp(timestamp);
telemetry.setName("changed records");
telemetry.setValue(10);
telemetryClient.trackMetric(telemetry);

enter image description here

As you can see in the screenshot, this works fine. But now I need a way to filter by the namespace and pod. For example, in my student work I have 3 different namespaces with 2 pods each.

Does anyone know a good way to get the namespace and pod information from my minikube cluster?

-- jan
azure
azure-log-analytics
azure-monitoring
kubernetes
minikube

1 Answer

1/13/2022

Pod fields such as namespace, node name, pod name and IP etc can be pass to your container via environment variables at runtime, checkout the example from the official document here.

-- gohm'c
Source: StackOverflow