共计 1121 个字符,预计需要花费 3 分钟才能阅读完成。
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/
正文完
发表至: prometheus
2021-09-07