Prometheus Operator安装
MiniKube环境准备
Prometheus Operator安装
安装helm
helm是专门针对K8S的一个包管理工具,使用helm就不需要编写复杂的应用文件,用helm可以在K8S上查找,安装,申请,回滚,卸载应用程序。
K8S中的包有个专门的术语,叫chart,就是预先配置好的K8S发布包,里头就是一些yaml文件。类似于centos中的YUM包。
获取helm压缩包并放好二进制文件
wget https://get.helm.sh/helm-v3.5.0-rc.2-linux-amd64.tar.gz
tar -zxvf helm-v3.5.0-rc.2-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm
添加helm的安装包源
下面这个官方的,我加了好久,没加上。
helm repo add stable https://charts.helm.sh/stable
所以选择Azure云这个吧:
helm repo add stable http://mirror.azure.cn/kubernetes/charts/
[ryan@lab3 root]$ helm repo add stable http://mirror.azure.cn/kubernetes/charts/
"stable" has been added to your repositories
[ryan@lab3 root]$ helm repo list
NAME URL
stable http://mirror.azure.cn/kubernetes/charts/
列出可选的chart包,很多
helm search repo stable
[ryan@lab3 root]$ helm search repo stable
NAME CHART VERSION APP VERSION DESCRIPTION
stable/acs-engine-autoscaler 2.1.3 2.1.1 Scales worker nodes within agent pools
stable/aerospike 0.1.7 v3.14.1.2 A Helm chart for Aerospike in Kubernetes
stable/anchore-engine 0.1.3 0.1.6 Anchore container analysis and policy evaluatio...
stable/artifactory 7.0.3 5.8.4 Universal Repository Manager supporting all maj...
stable/artifactory-ha 0.1.0 5.8.4 Universal Repository Manager supporting all maj...
stable/aws-cluster-autoscaler 0.3.2 Scales worker nodes within autoscaling groups.
stable/bitcoind 0.1.0 0.15.1 Bitcoin is an innovative payment network and a ...
stable/buildkite 0.2.1 3 Agent for Buildkite
stable/centrifugo 2.0.0 1.7.3 Centrifugo is a real-time messaging server.
查看prometheus安装包: 找到prometheus-operator
helm search repo prometheus
[ryan@lab3 root]$ helm search repo prometheus
NAME CHART VERSION APP VERSION DESCRIPTION
stable/prometheus 11.12.1 2.20.1 DEPRECATED Prometheus is a monitoring system an...
stable/prometheus-adapter 2.5.1 v0.7.0 DEPRECATED A Helm chart for k8s prometheus adapter
stable/prometheus-blackbox-exporter 4.3.1 0.16.0 DEPRECATED Prometheus Blackbox Exporter
stable/prometheus-cloudwatch-exporter 0.8.4 0.8.0 DEPRECATED A Helm chart for prometheus cloudwat...
stable/prometheus-consul-exporter 0.1.6 0.4.0 DEPRECATED A Helm chart for the Prometheus Cons...
stable/prometheus-couchdb-exporter 0.1.2 1.0 DEPRECATED A Helm chart to export the metrics f...
stable/prometheus-mongodb-exporter 2.8.1 v0.10.0 DEPRECATED A Prometheus exporter for MongoDB me...
stable/prometheus-mysql-exporter 0.7.1 v0.11.0 DEPRECATED A Helm chart for prometheus mysql ex...
stable/prometheus-nats-exporter 2.5.1 0.6.2 DEPRECATED A Helm chart for prometheus-nats-exp...
stable/prometheus-node-exporter 1.11.2 1.0.1 DEPRECATED A Helm chart for prometheus node-exp...
stable/prometheus-operator 9.3.2 0.38.1 DEPRECATED Provides easy monitoring definitions...
stable/prometheus-postgres-exporter 1.3.1 0.8.0 DEPRECATED A Helm chart for prometheus postgres...
stable/prometheus-pushgateway 1.4.3 1.2.0 DEPRECATED A Helm chart for prometheus pushgateway
stable/prometheus-rabbitmq-exporter 0.5.6 v0.29.0 DEPRECATED Rabbitmq metrics exporter for promet...
stable/prometheus-redis-exporter 3.5.1 1.3.4 DEPRECATED Prometheus exporter for Redis metrics
stable/prometheus-snmp-exporter 0.0.6 0.14.0 DEPRECATED Prometheus SNMP Exporter
stable/prometheus-to-sd 0.3.1 0.5.2 DEPRECATED Scrape metrics stored in prometheus ...
stable/elasticsearch-exporter 3.7.1 1.1.0 DEPRECATED Elasticsearch stats exporter for Pro...
stable/helm-exporter 0.3.3 0.4.0 DEPRECATED Exports helm release stats to promet...
创建命名空间:
kubectl create ns monitoring
安装prometheus-operator: install 后面紧跟的是你对它在K8S里的命名,后面的stable repo中的chart名,部署在monitoring空间:
helm install prometheus-operator stable/prometheus-operator -n monitoring
查看新namespace monitoring中都部了什么。。。:
kubectl get all -n monitoring
[ryan@lab3 root]$ kubectl get all -n monitoring
NAME READY STATUS RESTARTS AGE
pod/alertmanager-prometheus-operator-alertmanager-0 2/2 Running 0 128m
pod/prometheus-operator-grafana-686b547754-ldtvl 2/2 Running 0 138m
pod/prometheus-operator-kube-state-metrics-bd8f49464-fbrd4 1/1 Running 0 138m
pod/prometheus-operator-operator-7dfc554db-74fxr 2/2 Running 0 138m
pod/prometheus-operator-prometheus-node-exporter-mt2rl 1/1 Running 0 138m
pod/prometheus-prometheus-operator-prometheus-0 3/3 Running 1 127m
NAME TYPE CLUSTER