Prometheus


1. Run this script

KUBEADM_SYSTEMD_CONF=/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
sed -e "/cadvisor-port=0/d" -i "$KUBEADM_SYSTEMD_CONF"
if ! grep -q "authentication-token-webhook=true" "$KUBEADM_SYSTEMD_CONF"; then
  sed -e "s/--authorization-mode=Webhook/--authentication-token-webhook=true --authorization-mode=Webhook/" -i "$KUBEADM_SYSTEMD_CONF"
fi
systemctl daemon-reload
systemctl restart kubelet

If needed step 2 to 6
2. change "--bind-address" value from 127.0.0.1 to 0.0.0.0 in below two files

/etc/kubernetes/manifests/kube-controller-manager.yaml
/etc/kubernetes/manifests/kube-scheduler.yaml

3. Run below two commands (optional) 

k delete pod kube-controller-manager-minikube -n kube-system
k delete pod kube-scheduler-minikube -n kube-system

4. run command
kubectl api-resources | grep deployment

5. run command
kubectl api-resources | grep DaemonSet
Do require changes

6. kubectl edit clusterrole system:node

add following section in - apiGroups:

- apiGroups:
  - ""
  resources:
  - nodes/proxy
  verbs:
  - get

if needed step 7
7 k edit clusterrole prometheus

add "nodes/metrics"

URLs

http://127.0.0.1:30990/ Prometheus 
http://127.0.0.1:31400/  Grafana
http://127.0.0.1:30993/ Prometheus Alert Manager
=========================

The Prometheus resource declaratively describes the desired state of a Prometheus deployment, while a ServiceMonitor describes the set of targets to be monitored by Prometheus.

Reference : 
https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/getting-started.md

The Prometheus Operator reconciles services called prometheus-operated and alertmanager-operated, which are used as governing Services for the StatefulSets. To perform this reconciliation

The custom resources that the Prometheus Operator introduces are:
  • Prometheus
  • ServiceMonitor
  • PodMonitor
  • Alertmanager
  • PrometheusRule

0 comments:

Post a Comment