我正在尝试为我的Kubernetes集群设置AlertManager。我遵循了这个文档(https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/getting-started.md) -> Everything Ok。
为了设置AlertManager,我正在研究这篇文档(https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/alerting.md)
我正在获取alertmanager-example-0的CrashLoopBackOff。请检查附件中的日志:
第一张图片:$ kubectl logs -f prometheus-operator-88fcf6d95-zctgw -n monitoring
第二张图片:$ kubectl describe pod alertmanager-example-0


谁能指出我做错了什么?提前谢谢。
发布于 2018-11-30 03:28:49
听起来您遇到了一个问题,警报管理器pod使用的RBAC和Service Account (system:serviceaccount:monitoring:prometheus-operator)没有足够的权限与kube-apiserver通信。
在您的示例中,普罗米修斯运算符有一个如下所示的ClusterRoleBinding prometheus-operator:
$ kubectl get clusterrolebinding prometheus-operator -o=yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: prometheus-operator
name: prometheus-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus-operator
subjects:
- kind: ServiceAccount
name: prometheus-operator
namespace: monitoring更重要的是,ClusterRole应该看起来像这样:
$ kubectl get clusterrole prometheus-operator -o=yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app: prometheus-operator
name: prometheus-operator
rules:
- apiGroups:
- extensions
resources:
- thirdpartyresources
verbs:
- '*'
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- '*'
- apiGroups:
- monitoring.coreos.com
resources:
- alertmanager
- alertmanagers
- prometheus
- prometheuses
- service-monitor
- servicemonitors
- prometheusrules
verbs:
- '*'
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- '*'
- apiGroups:
- ""
resources:
- configmaps
- secrets
verbs:
- '*'
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- delete
- apiGroups:
- ""
resources:
- services
- endpoints
verbs:
- get
- create
- update
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- namespaces
verbs:
- list
- watchhttps://stackoverflow.com/questions/53545717
复制相似问题