Loki 连接在 Grafana 上被拒绝

Loki connection refused on Grafana

caller=client.go:349 component=client host=loki:3100 msg="错误发送批次,将重试" status=-1 error="Post "http://loki :3100/loki/api/v1/push": 拨打 tcp 172

请帮忙

我遇到了和你一样的问题。 最后我找到了丢失的 rbac。 我用下面的方法解决了:

  1. 获取 sa loki-promtail

kubectl get sa -n loki

NAME                SECRETS   AGE
default             1         17h
loki                1         41m
loki-grafana        1         41m
loki-grafana-test   1         41m
loki-promtail       1         41m
  1. 创建 ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: promtail-clusterrole
rules:
  - apiGroups: [""]
    resources:
    - nodes
    - services
    - pods
    verbs:
    - get
    - watch
    - list
  1. 创建 ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: promtail-clusterrolebinding
subjects:
    - kind: ServiceAccount
      name: loki-promtail  # your promtail sa
      namespace: loki
roleRef:
  kind: ClusterRole
  name: promtail-clusterrole
  apiGroup: rbac.authorization.k8s.io