Integration of Prometheus-Grafana Using Kuberenets !!

Integrating Prometheus-Grafana on K8s

Description :

Introduction:

Prerequisite:

Procedure to be followed.

Step-1

apiVersion: v1
kind: Service
metadata:
name: prometheus-svc
labels:
app: prometheus
spec:
selector:
app: prometheus
type: NodePort
ports:
- port: 9090
targetPort: 9090
nodePort: 31815
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: prom-pvc-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: prometheus-deploy
labels:
app: prometheus
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
strategy:
type: Recreate
template:
metadata:
name: prometheus-pod
labels:
app: prometheus
spec:
containers:
- name: prom
image: vimal13/prometheus
volumeMounts:
- name: prom-persistent-storage
mountPath: /prometheus/
volumes:
- name: prom-persistent-storage
persistentVolumeClaim:
claimName: prom-pvc-claim
apiVersion: v1
kind: Service
metadata:
name: grafana-svc
labels:
app: grafana
spec:
selector:
app: grafana
type: NodePort
ports:
- port: 3000
targetPort: 3000
nodePort: 31342
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-pvc-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana-deploy
labels:
app: grafana
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
name: grafana-pod
labels:
app: grafana
spec:
containers:
- name: graf-storage
image: vimal13/grafana
volumeMounts:
- name: graf-persistent-storage
mountPath: /var/lib/grafana
volumes:
- name: graf-persistent-storage
persistentVolumeClaim:
claimName: grafana-pvc-claim
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- prom.yaml
- grafa.yaml
kubectl create -k . 

or
kubectl apply -k .
<minikube ip>:<port number which you will assign >Here for Prometheus 192.168.99.102:31815 Here for Grafana    192.168.99.102:31342
Prometheus Interface
Grafana Interface
It is working fine

Tech Enthusiast…