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/
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。