How to monitor Kubernetes with Prometheus

Table of Contents

  1. Why Use Prometheus for Kubernetes monitoring?
  2. Kubernetes monitoring with Prometheus Architecture overview
  3. Installation of Prometheus server on ec2 instance
  4. Video Tutorial

1.Why Use Prometheus for Kubernetes monitoring?

  1. Monitoring needed to be democratized, made more accessible, and cover additional layers of the stack.
  2. Container-based infrastructures are radically changing how we do logging, debugging, high-availability…and monitoring is not an exception.
  3. Traditional monitoring tools are not designed to handle this.

2. Kubernetes monitoring with Prometheus Architecture overview

Figure-1

Prometheus service pulls the data matrix from different data sources like visualization, dashboard Kubernetes nodes, or services like Redis or Kubernetes API and pushes this metric alert to alert manager from that alert manager notification assigned to different users through a notification channel

3. Installation of Prometheus server on ec2 instance

  1. Install the Prometheus server on ec2 instance on which set up Kubernetes clusters, login as a root user. Now first of all we will be creating a Prometheus user.
  2. After creating Prometheus users we will create the directories of Prometheus files. Now we are Creating two directories and we will give the ownership of these directories to the user using the following commands.
FIgure-2

Now after this we will download the code of the Prometheus tool.

Figure-3

Now as the code is in zip format we will unzip it using this command.

Figure-4

Now the code has been unzipping we will move the files to a specific  folder, Now after that copy those files to the bin folder

Figure-5

Now all these commands being used so that the Prometheus tool has the root access to all the Kubernetes cluster and it can fetch the data matrix from those clusters and these two commands being used to provide ownership of the files to the user-created earlier

Figure-6

And also we will be moving the console and console library directories from Prometheus files and giving ownership to the user and for that, we will using these commands. Now we here we are moved console libraries and along with that giving ownership to the user to these libraries.

Figure-7

Now all these are mandatory steps to provide sufficient permission to Prometheus tool and after these permissions are given what we need to do is we need to create Prometheus.service file and this Prometheus.service file used to operate a Prometheus tool and we will simply paste this content into the file

Figure-8

This content is simply stating the type of user being used for the Prometheus tool and from here the tool is executed and the path is given to that. Now we will save this file.

Figure-9

Now once the file has been saved we have successfully configured the Prometheus.service file and once we will start the Prometheus service Prometheus.service file executes and after that, the Prometheus server will on. So just we need to reload the system service and we just reload the system service to start Prometheus service

Figure-10

Video Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *