88

学习 Kubernetes Operator(二):Prometheus Operator

 4 years ago
source link: http://muziyuchen.com/operator-2/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

更新至 kube-prometheus v0.3.0 版本

更新至 prometheus-operator v0.34.0 版本

Prometheus Operator 由两部分组成:

Prometheus Operator 包括:

  • 【CRD】Prometheus 定义 Prometheus 部署;
  • 【CRD】ServiceMonitor 声明一组 Service 如何监控;
  • 【CRD】PodMonitor 声明一组 Pod 如何监控;
  • 【CRD】PrometheusRule 定义 Prometheus Rule 文件;
  • 【CRD】Alertmanager 定义 Alertmanager 部署;
  • 【Controller】prometheus-operator 监控 CRD 部署和管理 Prometheus 集群。

:point_down:为 Prometheus Operator 架构图:

J3YJzmz.png!web

准备

Kubernetes

Kubernetes >= v1.8.0

添加 kubelet 启动参数:

--authentication-token-webhook=true
--authorization-mode=Webhook

镜像

由于功夫网的原因导致 qury.io 的镜像下载失败。可以使用 Azure 中国提供的镜像服务器,感谢!!!

:point_down:是原始镜像列表:

quay.io/coreos/prometheus-operator:v0.34.0
quay.io/prometheus/prometheus:v2.11.0
quay.io/coreos/prometheus-config-reloader:v0.34.0
quay.io/coreos/configmap-reload:v0.0.1
quay.io/prometheus/alertmanager:v0.18.0
quay.io/coreos/k8s-prometheus-adapter-amd64:v0.5.0
quay.io/coreos/kube-rbac-proxy:v0.4.1
quay.io/coreos/kube-state-metrics:v1.9.0
quay.io/prometheus/node-exporter:v0.18.1

quay.io 替换为 quay.azk8s.cn 拉取 Azure 中国镜像,以 prometheus-operator 举:chestnut::

docker pull quay.azk8s.cn/coreos/prometheus-operator:v0.34.0

以 prometheus-operator 举:chestnut:,重新打 tag:

docker tag quay.azk8s.cn/coreos/prometheus-operator:v0.34.0 quay.io/coreos/prometheus-operator:v0.34.0

以此类推,完成所有列表中的镜像。

部署

coreos/kube-prometheus 项目克隆岛本地:

git clone -b v0.3.0 https://github.com/coreos/kube-prometheus.git

部署 Prometheus Operator:

kubectl create -f manifests/setup

部署 Kubernetes 集群监控:

kubectl create -f manifests/

参考


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK