7

prometheus-operator使用(一) -- 整体架构

 3 years ago
source link: https://segmentfault.com/a/1190000040637810
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.
neoserver,ios ssh client

prometheus-operator使用(一) -- 整体架构

发布于 今天 12:03

prometheus-operator部署形式为deployment,其使用operator框架开发,operator本质上是CRD+controller:

  • CRD: prometheus/prometheusurle/alertmanager/serviceMonitor/podMonitor等;
  • controller: 监听CRD的变化,修改相应的资源配置;

prometheus-operator包含的CRD:

  • prometheus: 对prometheus-server的抽象;
  • serviceMonitor: 对service监控对象的抽象;
  • podMonitor: 对pod监控对象的抽象;
  • prometheusrule: 对prometheus报警规则的抽象;

prometheus-operator的使用,基本是如何操作上述的CRD对象。

查看CRD类型:

# kubectl get crd |grep coreos
alertmanagers.monitoring.coreos.com                   2021-05-28T08:02:20Z
podmonitors.monitoring.coreos.com                     2021-05-28T08:02:21Z
prometheuses.monitoring.coreos.com                    2021-05-28T08:02:22Z
prometheusrules.monitoring.coreos.com                 2021-05-28T08:02:23Z
servicemonitors.monitoring.coreos.com                 2021-05-28T08:02:24Z
thanosrulers.monitoring.coreos.com                    2021-05-28T08:02:25Z

查看特定CRD类型下的实例:

# kubectl get prometheuses -n monitoring
NAME   VERSION   REPLICAS   AGE
k8s    v2.20.0   2          46h
# kubectl get servicemonitors -n monitoring
NAME                      AGE
alertmanager              46h
coredns                   46h
etcd-k8s                  19h
kube-apiserver            46h
kube-controller-manager   46h
kube-scheduler            46h
kube-state-metrics        46h
kubelet                   46h
node-exporter             46h
prometheus                46h
prometheus-adapter        46h
prometheus-operator       46h

参考:
1.operator开发/部署:https://www.qikqiak.com/post/k8s-operator-101/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK