Tuesday, January 3, 2023

Deploy Prometheus and Grafana on Kubernetes

  

Deploy Prometheus and Grafana on Kubernetes 

Helm is a package manager for Kubernetes applications event the more complex via charts. Basically, it templates the YAML components from a single file containing the custom values. There are Terraform providers for Helm and Kubernetes to integrate them in your codebase.
In this lab, we'll set up a monitoring stack with Prometheus and Grafana. Terraform will configure the chart values to make them communicate together. When you use the Helm provider the charts are considered as resources. Reused attributes from a Helm chart in another will create a dependency and manage the deployment orchestration.
the steps after you have successfully cloned the repo

cd kube-prometheus to deploy prometheus and grafana dashboard

kubectl create -f manifests/setup

kubectl create -f manifests/


Kubectl get svc -n monitoring to get the Nodeport for Grafana

Kubectl describe svc -n monitoring to see which instance grafana is deployed on


An easy way to access Prometheus, Grafana, and Alertmanager dashboards is by using kubectl port-forward once all the services are running:

Second method: Accessing Prometheus UI and Grafana dashboard using NodePort (Only for private clusters) To access Prometheus, Grafana, and Alertmanager dashboards using one of the worker nodes IP address and a port you’ve to edit the services and set the type to NodePort.

The Node Port method is only recommended for local clusters not exposed to the internet. The basic reason for this is insecurity of Prometheus/Alertmanager services.

kubectl --namespace monitoring patch svc prometheus-k8s -p '{"spec": {"type": "NodePort"}}'

kubectl --namespace monitoring patch svc grafana -p '{"spec": {"type": "NodePort"}}'





No comments:

Post a Comment

Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, deploy WARs using Jenkins Pipeline - Build pipelines integrate with github, Sonarqube, Slack, JaCoCo, Nexus, Tomcat

  Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, depl...