0

我正在尝试使用 LogCLI 查询 LOKI,但每次尝试查询时,我都会收到错误消息 Query failed: "Get http://...": dial tcp <ip_address>: connect: connection denied" 我已安装loki 使用 helm chart 并创建了入口服务来公开它。安装 loki 的步骤:

$ helm repo add grafana https://grafana.github.io/helm-charts
"grafana" has been added to your repositories

$ helm repo update
...
Update Complete. ⎈Happy Helming!⎈

$ helm upgrade --install loki grafana/loki-stack


$ kubectl get pods | grep loki
loki-0                            1/1     Running   0          76s
loki-promtail-hm8kn               1/1     Running   0          76s
loki-promtail-nkv4p               1/1     Running   0          76s
loki-promtail-qfrcr               1/1     Running   0          76s

入口服务 yaml 文件:

$ cat ingress.yml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: loki-ingress
spec:
  rules:
    - http:
        paths:
          - backend:
              serviceName: loki
              servicePort: 3100
            path: /

$ kubectl get ing
NAME           CLASS    HOSTS   ADDRESS        PORTS   AGE
loki-ingress   <none>   *       10.128.0.6     80      7h

$ kubectl get svc
NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
kubernetes               ClusterIP   10.96.0.1        <none>        443/TCP          21h
loki                     ClusterIP   10.128.219.87    <none>        3100/TCP         16h
loki-headless            ClusterIP   None             <none>        3100/TCP         16h

目前我正在尝试使用以下方法访问 loki 日志:

$ export LOKI_ADDR="http://10.128.0.6"
$ logcli query '{app="events-collector"}'
http://10.128.0.6/loki/api/v1/query_range?direction=BACKWARD&end=1626690093532398790&limit=30&query=%7Bapp%3D%22events-collector%22%7D&start=1626686493532398790
Query failed: Get "http://10.128.0.6/loki/api/v1/query_range?direction=BACKWARD&end=1626690093532398790&limit=30&query=%7Bapp%3D%22events-collector%22%7D&start=1626686493532398790": dial tcp 10.128.0.6:80: connect: connection refused

在这种情况下如何查询 Loki?

4

0 回答 0