Helm/Prometheus Stack: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
  helm repo add prometheus https://prometheus-community.github.io/helm-charts
  helm repo add prometheus https://prometheus-community.github.io/helm-charts
  helm repo update
  helm repo update && helm repo list
helm repo list


==Config==
==Config==
Line 13: Line 12:
{|
{|
|colspan="2"|
|colspan="2"|
<syntaxhighlight lang="yaml">
'''High Lighted''' lines are omitted for Minikube local deployment
<syntaxhighlight lang="yaml" highlight="12-15,21-24,30-33" line>
helm search repo kube-prometheus-stack
helm show values prometheus/kube-prometheus-stack --version=61.6.0|less
helm show values prometheus/kube-prometheus-stack --version=65.0.0|less
 
kubectl create namespace prometheus
kubectl create namespace prometheus
helm show values prometheus/kube-prometheus-stack|less
cat <<YML | helm install -n prometheus prometheus prometheus/kube-prometheus-stack --version=65.0.0 -f -
cat <<YML | helm install -n prometheus prometheus prometheus/kube-prometheus-stack -f -
prometheus:
prometheus:
   ingress:
   ingress:
Line 23: Line 26:
     - prometheus.k8s.local
     - prometheus.k8s.local
   tls:
   tls:
   - secretName: prometheus.k8s.local.tls
   - secretName: prometheus-tls
       hosts:
       hosts:
       - prometheus.k8s.local
       - prometheus.k8s.local
alertmanager:
alertmanager:
   ingress:
   ingress:
Line 33: Line 35:
     - alertmanager.k8s.local
     - alertmanager.k8s.local
   tls:
   tls:
   - secretName: alertmanager.k8s.local.tls
   - secretName: alertmanager-tls
       hosts:
       hosts:
       - alertmanager.k8s.local
       - alertmanager.k8s.local
grafana:
grafana:
   ingress:
   ingress:
Line 43: Line 44:
     - grafana.k8s.local
     - grafana.k8s.local
   tls:
   tls:
   - secretName: grafana.k8s.local.tls
   - secretName: grafana-tls
       hosts:
       hosts:
       - grafana.k8s.local
       - grafana.k8s.local
Line 119: Line 120:
| valign="top" |
| valign="top" |
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
helm install -n prometheus    prometheus prometheus/kube-prometheus-stack
helm install -n prometheus    prometheus prometheus/kube-prometheus-stack --version 61.6.0
helm upgrade -n prometheus -i prometheus prometheus/kube-prometheus-stack
helm upgrade -n prometheus -i prometheus prometheus/kube-prometheus-stack --version 61.6.0
helm show values prometheus/prometheus|less
helm show values prometheus/prometheus --version 61.6.0|less
</syntaxhighlight>
</syntaxhighlight>


Line 201: Line 202:
* [https://github.com/prometheus-community/helm-charts Helm » Prometheus » GitHub]
* [https://github.com/prometheus-community/helm-charts Helm » Prometheus » GitHub]
* [https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack Helm » Prometheus Stack]
* [https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack Helm » Prometheus Stack]
* [[Helm/Cert Manager|Helm » Cert Manager]]
* [[Helm/Prometheus|Helm » Prometheus]]
* [[Helm/Prometheus|Helm » Prometheus]]
* [[Helm/Grafana|Helm » Grafana]]
* [[Helm/Grafana|Helm » Grafana]]
Line 247: Line 249:


| valign="top" |
| valign="top" |
* [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]]


| valign="top" |
| valign="top" |


|}
|}

Latest revision as of 22:12, 5 October 2024

helm repo add prometheus https://prometheus-community.github.io/helm-charts
helm repo update && helm repo list

Config

export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"

Install

High Lighted lines are omitted for Minikube local deployment

helm search repo kube-prometheus-stack
helm show values prometheus/kube-prometheus-stack --version=61.6.0|less
helm show values prometheus/kube-prometheus-stack --version=65.0.0|less

kubectl create namespace prometheus
cat <<YML | helm install -n prometheus prometheus prometheus/kube-prometheus-stack --version=65.0.0 -f -
prometheus:
  ingress:
    enabled: true
    hosts:
    - prometheus.k8s.local
  tls:
  - secretName: prometheus-tls
      hosts:
      - prometheus.k8s.local
alertmanager:
  ingress:
    enabled: true
    hosts:
    - alertmanager.k8s.local
  tls:
  - secretName: alertmanager-tls
      hosts:
      - alertmanager.k8s.local
grafana:
  ingress:
    enabled: true
    hosts:
    - grafana.k8s.local
  tls:
  - secretName: grafana-tls
      hosts:
      - grafana.k8s.local
YML

xdg-open http://grafana.k8s.local &>/dev/null &
gnome-open http://grafana.k8s.local &>/dev/null &
x-www-browser http://grafana.k8s.local &>/dev/null &
sensible-browser http://grafana.k8s.local &>/dev/null &

xdg-open http://prometheus.k8s.local &>/dev/null &
gnome-open http://prometheus.k8s.local &>/dev/null &
x-www-browser http://prometheus.k8s.local &>/dev/null &
sensible-browser http://prometheus.k8s.local &>/dev/null &

xdg-open http://alertmanager.k8s.local &>/dev/null &
gnome-open http://alertmanager.k8s.local &>/dev/null &
x-www-browser http://alertmanager.k8s.local &>/dev/null &
sensible-browser http://alertmanager.k8s.local &>/dev/null &

Uninstall

helm uninstall -n prometheus prometheus
kubectl delete namespace prometheus

Playground

PROMETHEUS_STATE_POD_NAME="$(kubectl -n prometheus get pod -l 'app.kubernetes.io/name=kube-state-metrics' -o json|jq -r '.items[0].metadata.name')"
PROMETHEUS_POD_NAME="$(kubectl -n prometheus get pod -l 'app.kubernetes.io/name=prometheus' -o json|jq -r '.items[0].metadata.name')"

helm install -n prometheus    prometheus prometheus/kube-prometheus-stack --version 61.6.0
helm upgrade -n prometheus -i prometheus prometheus/kube-prometheus-stack --version 61.6.0
helm show values prometheus/prometheus --version 61.6.0|less
kubectl -n prometheus exec -it ${PROMETHEUS_POD_NAME} -- cat /etc/prometheus/prometheus.yml
kubectl -n prometheus exec -it ${PROMETHEUS_POD_NAME} -- ls -lah /etc/prometheus
kubectl -n prometheus exec -it ${PROMETHEUS_POD_NAME} -- /bin/sh

kubectl -n prometheus rollout restart deploy prometheus-kube-prometheus-operator
kubectl -n prometheus logs -f ${PROMETHEUS_POD_NAME}
kubectl -n prometheus logs -f prometheus-server-hash
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten

kubectl -n prometheus get  cm     prometheus-server-conf -o yaml
kubectl -n prometheus edit deploy prometheus-server -o yaml
kubectl -n prometheus get  deploy prometheus-server -o yaml
prometheus-kube-prometheus-alertmanager.prometheus.svc.cluster.local
prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local
prometheus-grafana.prometheus.svc.cluster.local:3000

kubectl -n prometheus delete all --all
kubectl -n prometheus delete ing --all
kubectl -n prometheus delete sts --all
kubectl -n prometheus delete svc --all
kubectl -n prometheus delete pvc --all
kubectl -n prometheus delete pv  --all

References