Metrics, monitoring, and alerting are the key components of a monitoring system. It is vital to have a proper monitoring system enabled on Kubernetes clusters, to monitor and observe the deployed applications, as well as the Kubernetes infrastructure
How do you monitor your application? Chances are, if you're running containerized application, then you are using Prometheus along with some other visualization/ dashboarding tool like Grafana, New-relic, or others. Prometheus is the defacto standard when it comes to monitoring your application.
Prometheus
Prometheus has been one of the go-to choices of cloud-native users for setting up monitoring stack. It is an open-source monitoring framework that comes with a time-series database, flexible query language, and a modern alerting mechanism. With Devtron's charts marketplace, you get all the community-trusted helm charts; if there aren't any, you can easily add that. Check out this blog for detailed insights about deploying helm charts with devtron.

Further in the blog, we will deploy a Prometheus helm chart and see how it can be used to get real-time metrics of all applications deployed through Devtron.
Grafana
Grafana is an open-source observability platform that helps you observe the metrics of your application with a beautiful dashboard and customization as per your needs. It is packaged in Devtron by default, and one can install it from the integration that Devtron comes with. The beauty of integrations that Devtron brings in is that users don't have to worry about the different tools and their complexities. All the heavy lifting is carried out by Devtron and users just need to interact with the Devtron dashboard. In case, you want to access the Grafana dashboard, you need to port forward the devtron-grafana
service if Devtron is running in the local system or exposes it via ingress.
kubectl -n devtroncd port-forward svc/devtron-grafana 3000:80 &
Go to your browser and type the URL, In our case, it is localhost:3000, and you should see this. Click on the sign-in button at the bottom left corner.

You should see this on the login page of Grafana.

To login into the Grafana dashboard, your username is admin
and you can get your password by executing the following command:
kubectl -n devtroncd get secret devtron-secret -o jsonpath='{.data.GRAFANA_PASSWORD}' | base64 -d
Monitoring Stack with Devtron
Devtron has been built in a modular fashion where-in you can install different integrations as per your requirements. For monitoring, the default integration is Grafana, as mentioned above. Once Grafana has been installed, now we need to set up metrics collector, which would scrape all the metrics and act as a data source for Grafana. In this tutorial, we will set up Prometheus and add it to the Devtron dashboard for fetching application metrics.
Installing Prometheus
Go to the chart store and search for Prometheus. Use the Prometheus-community's kube-prometheus-stack
chart to deploy Prometheus.

Once you select a chart, you must configure the values per your requirements before deploying. In our case, let's make the following changes.
kube-state-metrics:
metricLabelsAllowlist:
- pods=[*]
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorSelectorNilUsesHelmValues: false
Search for the above parameters and set these values as defined above. Additionally, if you want to expose the Prometheus dashboard via ingress, you can enable the ingress and provide the hostname for it, and likewise for Grafana which is being bundled with kube-prometheus-chart

Now, after installing Prometheus, you need to get the endpoint of the Prometheus server. For every helm chart or application deployed at Devtron, you get a resource-grouped view for all Kubernetes resources deployed along with him. To get the endpoint, under Networking
go-to service
expand the Prometheus server service and you should be able to see the Endpoints along with EndpointSlice as shown below.

Enable Application Metrics
Not to use Prometheus as a data source for Grafana, go to Global Configurations
-> Clusters & Environments
and for the respective cluster where you have installed the Prometheus chart, add the endpoint as mentioned below and click on Update Cluster
.

Once you add the endpoint, you will be able to see the application metrics in the Devtron dashboard for all the applications deployed in the respective cluster irrespective of the environment (ns) it is being deployed.

With this, you will be able to track your application metrics like resource usage, CPU usage, Throughput, and Latency. For Throughput and Latency, you need to enable the application metrics for respective environments from Deployment Template
as mentioned below.

Conclusion
This is how you can set up a monitoring stack for Kubernetes with Devtron and easily observe and monitor all your applications. You can also use other tools such as Robusta, Pixie, New-relic, and other monitoring tools with Devtron, as it provides the flexibility to integrate with any tool of your choice.
Feel free to check out the documentation for more info, and if you like Devtron, do give it a star on GitHub.