140 words
1 minute
[Kubernetes]10. Loki
2025-05-28
2026-03-23

Loki has been configured with a gateway (nginx) to support reads and writes from a single component.

You can send logs from inside the cluster using the cluster DNS:

http://loki-gateway.loki.svc.cluster.local/loki/api/v1/push

You can test to send data from outside the cluster by port-forwarding the gateway to your local machine:

kubectl port-forward —namespace loki svc/loki-gateway 3100:80 &

And then using http://127.0.0.1:3100/loki/api/v1/push URL as shown below:

Terminal window
curl -H "Content-Type: application/json" -XPOST -s "http://127.0.0.1:3100/loki/api/v1/push" \
--data-raw "{\"streams\": [{\"stream\": {\"job\": \"test\"}, \"values\": [[\"$(date +%s)000000000\", \"fizzbuzz\"]]}]}" \
-H X-Scope-OrgId:foo

Then verify that Loki did receive the data using the following command:

Terminal window
curl "http://127.0.0.1:3100/loki/api/v1/query_range" --data-urlencode 'query={job="test"}' -H X-Scope-OrgId:foo | jq .data.result

관련 문서#

  • [[k8s_08_grafana|[Kubernetes]08. Grafana]] tag overlap 0.67
  • [[k8s_09_alertmanager|[Kubernetes]09. Alertmanager]] tag overlap 0.67
  • [[k8s_01_install|[Kubernetes]01. 기본 컨셉과 설치]] tag overlap 0.33
  • [[k8s_02_commands|[Kubernetes]02. 기본명령어와 오브젝트]] tag overlap 0.33
  • [[k8s_03_troubleshooting|[Kubernetes]03. Troubleshooting]] tag overlap 0.33
[Kubernetes]10. Loki
https://yjinheon.netlify.app/posts/05system/k8s/k8s_10_loki/
Author
Datamind
Published at
2025-05-28
License
CC BY-NC-SA 4.0