?? DevOps Task-5 ??

?? DevOps Task-5 ??

Deploy prometheus and grafana on the top of kubernetes .

Tasks :

Integrate Prometheus and Grafana and perform in following way:

1. Deploy them as pods on top of Kubernetes by creating resources Deployment, ReplicaSet, Pods or Services

2. And make their data to be remain persistent 

3. And both of them should be exposed to outside world

What is Prometheus ??

Prometheus is a free software application used for event monitoring and alerting. It records real-time metrics in a time series database built using a HTTP pull model, with flexible queries and real-time alerting.

It stores data locally on disk, which helps for fast data storage and fast querying. There is ability to store metrics in remote storage .It collects data in the form of time series.

Whats is Grafana ??

Grafana is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources. It is expandable through a plug-in system. End users can create complex monitoring dashboards using interactive query builders.

As a visualization tool, Grafana is a popular component in monitoring stacks, often used in combination with time series databases such as InfluxDB, Prometheus and Graphite; monitoring platforms such as Sensu,Icinga, Zabbix, Netdata, and PRTG; SIEMs such as Elasticsearch and Splunk; and other data sources.

No alt text provided for this image

Data Persistence is “the continuance of an effect after its cause is removed”. In the context of storing data in a computer system, this means that the data survives after the process with which it was created has ended. In other words, for a data store to be considered persistent, it must write to non-volatile storage.

To Integrate Prometheus and Grafana we are going to use Kubernetes …

Steps to Integrate Prometheus & Grafana 

Step 1 : Create the docker images of the Grafana And Prometheus...

Docker image of Prometheus

I have download tar file of prometheus and then extract it using command

tar -xzf prometheus-2.18.1.linux-amd64.tar.gz

and in the same folder where we have promeutheus extracted file , i am going create a Dockerfile in which i have written below code for building image of prometheus.

FROM centos


COPY prometheus-2.20.1.linux-amd64  /


EXPOSE 9090
CMD ["./prometheus"]

now run the command to build image

docker build -t tushardighe/prometheus . 

once image is created push it to docker hub using command

docker push tushardighe/prometheus

Docker image of Grafana

Similar process as we done for promtheus image , we will do for grafana too.

we will create a dockerfile that will contain code for building image of grafana

FROM centos


RUN yum install wget -y


RUN wget https://dl.grafana.com/oss/release/grafana-7.1.1-1.x86_64.rpm


RUN yum install grafana-7.1.1-1.x86_64.rpm  -y


EXPOSE 3000


WORKDIR /usr/share/grafana/
CMD ["/usr/sbin/grafana-server","--config=/etc/grafana/grafana.ini"]

So then build the image and push the dockerhub using below commands

docker build -t tushardighe/grafana . 

docker push tushardighe/grafana

Step 2 : To make data persistent of prometheus and grafana server . Create pvc for both pods … Here is the code …

---
apiVersion: v1
kind: PersistentVolumeClaim


metadata:
  name: prometheus-pvc
  labels:
    name: prometheuspvc


spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---


apiVersion: v1
kind: PersistentVolumeClaim


metadata:
  name: grafana-pvc
  labels:
    name: grafanapvc


spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---

Step 3 : Write the code for deploying prometheus and grafana …. And expose to world … Here I wrote deployment and service in single file …

The Deployment code & all codes is my github account so link : https://github.com/dighetushar654/DevOps_Task-5

Step 4 : For Automation purpose , I am going to write a kustomization yml code …

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization


resources:
  - pvc.yml
  - deploygrafprom.yml

Now type the command “ kubectl apply -k . “ in console…

Note : Run the cmd only in the respective folder,, Means go to folder where u have created kustomization.yml , pvc.yml , deploygrafprom.yml ….

Output :

No alt text provided for this image

Prometheus port → 32507 ( It is a random port number )

Grafana Port → 31157( It is a random port number )

Prometheus Server

No alt text provided for this image

Grafana Server

No alt text provided for this image

Finally done with the task ….

Thanks for Reading …







要查看或添加评论,请登录

Tushar Dighe的更多文章

  • Enhancing Cloud Security with Wiz: A Game-Changer for DevOps and Security Teams

    Enhancing Cloud Security with Wiz: A Game-Changer for DevOps and Security Teams

    Enhancing Cloud Security with Wiz: A Game-Changer for DevOps and Security Teams In today's fast-paced cloud…

  • AWS : NASA Case Study

    AWS : NASA Case Study

    Established in 1958, the National Aeronautics and Space Administration (NASA) has been working around the world—and off…

  • The World of “Big Data”

    The World of “Big Data”

    What is data? The quantities, characters, or symbols on which operations are performed by a computer, which may be…

  • ?? Hybrid Multi Cloud Task-3??

    ?? Hybrid Multi Cloud Task-3??

    INTEGRATION OF WORDPRESS RUNNING ON TOP OF KUBERNETES CLUSTER WITH AWS RDS.?? So, you might be thinking that what is…

    2 条评论
  • ?? Hybrid Multi Cloud Task-2??

    ?? Hybrid Multi Cloud Task-2??

    Using EFS service with Terraform. Objective: Perform the task-1 using EFS instead of EBS service on the AWS as…

  • ?? Hybrid Multi Cloud Task-1??

    ?? Hybrid Multi Cloud Task-1??

    To launch Webserver with AWS using Terraform code Steps required to launch the App using terraform:- 1. Create the key…

  • ?? Ansible Task-2??

    ?? Ansible Task-2??

    Deploying Web Server on AWS through ANSIBLE! TASK DESCRIPTION: ?? Provision EC2 instance through ansible. ?? Retrieve…

  • ?? DevOps Task-6 ??

    ?? DevOps Task-6 ??

    Integration of Jenkins with Kubernetes using groovy What is Groovy? Groovy is a Java-syntax-compatible object-oriented…

  • ?? DevOps Task-4 ??

    ?? DevOps Task-4 ??

    In this article i have created a fully automated CI/CD build pipeline by using the technology git, github, Jenkins…

  • ?? Ansible Task-1 ??

    ?? Ansible Task-1 ??

    Integrate Ansible with Docker What is Ansible ?? Ansible is an open-source automation tool, or platform, used for IT…

    2 条评论

社区洞察

其他会员也浏览了