helm 部署Prometheus
環境資訊:
kubernetes版本:v1.18.2(kubeasz部署)
helm 版本:v3.2.1
系統版本:centos7.7
helm倉庫:http://mirror.azure.cn/kubernetes/charts
一、部署Prometheus-operator
1、安裝helm3並新增倉庫
wget https://get.helm.sh/helm-v3.2.1-linux-amd64.tar.gz
tar -xf helm-v3.2.1-linux-amd64.tar.gz
mv ./linux-amd64/helm /usr/bin
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm search repo prometheus-community
2、映象下載
1>prometheus-operator 涉及到的映象
quay.io/prometheus/alertmanager:v0.21.0
docker.io/jimmidyson/configmap-reload:v0.3.0
kiwigrid/k8s-sidecar:0.1.151
grafana/grafana:7.0.5
quay.io/coreos/kube-state-metrics:v1.9.7
quay.io/coreos/prometheus-operator:v0.38.1
squareup/ghostunnel:v1.5.2
quay.io/prometheus/node-exporter:v1.0.0
quay.io/prometheus/prometheus:v2.18.2
quay.io/coreos/prometheus-config-reloader:v0.38.1
docker.io/jimmidyson/configmap-reload:v0.3.0
2>上述映象已經匯出,可以通過docker run 方式copy一份,或者通過百度網盤下載(605M)
docker run -itd --name=download registry.baidubce.com/tools/download-prometheus-operator:v0.38.1
docker cp download:/opt/prometheus-operator-0381.tar .
或者百度網盤下載
連結:https://pan.baidu.com/s/1jAKS7fHeuz8xy3alraBDJA
提取碼:f219
最後再各個節點載入映象
docker load -i prometheus-operator-0381.tar
3、部署Prometheus
1>部署prometheus-operator
想要提前自定義配置可以把chart包下載下來
#helm pull prometheus-community/prometheus-operator(可選)
kubectl create ns monitoring
helm install prometheus-operator --set rbacEnable=true --namespace=monitoring --wait prometheus-community/prometheus-operator
2>、安裝失敗清理(如果安裝失敗無法使用helm解除安裝)
kubectl -n monitoring get deployments.apps|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete deployments.apps
kubectl -n monitoring get svc|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete svc
kubectl -n monitoring get sts|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete sts
kubectl -n monitoring get crd|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete crd
kubectl -n monitoring get servicemonitorings.monitoringing.coreos.com|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete servicemonitorings.monitoringing.coreos.com
kubectl -n monitoring get ds|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete ds
kubectl -n monitoring get job|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete job
kubectl -n monitoring get pod|tail -n +2|awk '{print $1}'|xargs kubectl -n monitoring delete pod
kubectl get PodSecurityPolicy|grep prome|awk '{print $1}'|xargs kubectl delete podsecuritypolicies.policy
kubectl get clusterrole|grep prometheus|awk '{print $1}'|xargs kubectl delete clusterrole
kubectl get clusterrolebindings.rbac.authorization.k8s.io|grep prometheus|awk '{print $1}'|xargs kubectl delete clusterrolebindings.rbac.authorization.k8s.io
kubectl -n kube-system get svc|grep prometheus|awk '{print $1}'|xargs kubectl -n kube-system delete svc
kubectl -n kube-system get mutatingwebhookconfigurations.admissionregistration.k8s.io|grep prometheus|awk '{print $1}'|xargs kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io
kubectl -n kube-system get validatingwebhookconfigurations.admissionregistration.k8s.io|grep prometheus|awk '{print $1}'|xargs kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io
kubectl delete ns monitoring
3>通過nodeport或者ingress暴露grafana和prometheus
kubectl -n monitoring patch svc prometheus-operator-grafana -p '{"spec":{"type":"NodePort"}}'
kubectl -n monitoring patch svc prometheus-operator-prometheus -p '{"spec":{"type":"NodePort"}}'
獲取grafana admin使用者密碼
kubectl -n monitoring get secrets |grep Opaque|grep grafana|awk '{print $1}'|xargs kubectl -n monitoring get secrets -o yaml|grep admin-password|grep -v f:|awk -F "admin-password: " '{print $2}'|base64 -d
二、告警
1、自定義告警規則
2、配置smtp
3、ldap管理grafana使用者
相關文章
- helm部署mysqlMySql
- Helm部署xxl-job
- 透過 Helm Chart 部署 Easysearch
- Helm部署和體驗jenkinsJenkins
- 部署prometheus、grafana、alertmanagerPrometheusGrafana
- Helm Chart 部署 Redis 的完美指南Redis
- Helm部署k8s應用K8S
- helm部署的服務如何修改配置
- helm包安裝部署相關命令
- helm部署traefik到k8sK8S
- 部署和體驗Helm(2.16.1版本)
- 使用 helm 部署 k8s 資源K8S
- Helm, 在Kubernetes中部署應用的利器
- 053.叢集管理-Helm部署及使用
- docker部署監控Prometheus+GrafanaDockerPrometheusGrafana
- Docker環境部署Prometheus實踐DockerPrometheus
- K8s 部署 Prometheus + GrafanaK8SPrometheusGrafana
- Kubernetes+Prometheus+Grafana部署筆記PrometheusGrafana筆記
- 如何使用 Helm 在 K8s 上整合 Prometheus 和 Grafana|Part 1K8SPrometheusGrafana
- apisix~helm方式的部署到k8sAPIK8S
- EggJS 雲原生應用硬核實戰(Kubernetes+Traefik+Helm+Prometheus+Grafana),提供 DemoJSPrometheusGrafana
- 1-Prometheus基本概念與部署Prometheus
- Prometheus從入門到精通:一、部署Prometheus
- 在 k8s 中部署 PrometheusK8SPrometheus
- helm在k8s上部署Elasticsearch和KibanaK8SElasticsearch
- 二進位制部署 Prometheus+Alertmanager+GrafanaPrometheusGrafana
- kubernetes1.15極速部署prometheus和grafanaPrometheusGrafana
- 部署 Prometheus 和 Grafana 到 k8sPrometheusGrafanaK8S
- Prometheus監控系統入門與部署Prometheus
- 使用Karmada實現Helm應用的跨叢集部署
- Kubernetes-基於Helm安裝部署高可用的RedisRedis
- docker部署Prometheus+AlertManager實現郵件告警DockerPrometheus
- Helm
- Kubernetes雲原生儲存解決方案openebs部署實踐-3.10.0版本(helm部署)
- 容器雲平臺監控告警體系(三)—— 使用Prometheus Operator部署並管理Prometheus ServerPrometheusServer
- helm upgrade
- 部署Prometheus Operator完整流程及踩坑解決思路Prometheus
- 部署Prometheus監控平臺,6個不可少的因素Prometheus