Logo von K8s Loki Troubleshooting

K8s Loki Troubleshooting

Organisation
k8s-servant
k8s-loki-troubleshooting

Verwenden Sie diesen Skill, wenn Grafana Loki unter Kubernetes Logs ablehnt, verwirft oder nicht abfragen kann: Clients erhalten 400, 401 oder 429 von /loki/api/v1/push, "write operation failed", "has timestamp too old", "entry too far behind", "Per stream rate limit exceeded", "ingestion rate limit exceeded", "maximum active stream limit exceeded", "no org id" (fehlender X-Scope-OrgID-Mandant), Loki stürzt beim Start mit "validating config" oder "invalid schema config" ab, "failed to flush chunks", Ring- oder Memberlist-Fehler ("empty ring", "too many unhealthy instances in the ring") oder Abfragen schlagen mit "the query time range exceeds the limit" fehl oder laufen in einen Timeout. Der Skill untersucht das Problem mit kubectl get, Logs und den schreibgeschützten Loki-Endpunkten und schlägt Lösungen vor. Er prüft zuerst und fragt, bevor er etwas ändert.

Übersicht

Herausgeberk8s-servant
Repositoryk8s-skills
Skill-Namek8s-loki-troubleshooting
Sterne
36
Forks
7
Mitgelieferte Dateien
2
LizenzApache-2.0
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 2

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von k8s-servant auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill K8s Loki Troubleshooting in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-loki-troubleshooting
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/k8s-servant/k8s-skills.git /tmp/k8s-skills
mkdir -p .claude/skills
cp -r /tmp/k8s-skills/skills/k8s-loki-troubleshooting .claude/skills/k8s-loki-troubleshooting
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie K8s Loki Troubleshooting in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt K8s Loki Troubleshooting automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist K8s Loki Troubleshooting nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

Loki troubleshooting

Find out why Loki does not accept, keep or return logs, and propose a fix. Read first, ask before changing. Run the investigation commands freely. Run a command under an "Ask first" line only after the user approves that exact command; if your credentials do not allow it, give it to the user to run. Never run a "Proposed fix"; hand it to the user.

Clients (Promtail, Grafana Alloy, Fluent Bit, the OpenTelemetry Collector) push log lines to /loki/api/v1/push. The distributor validates each line (labels, size, age) and applies the tenant's ingestion rate; the ingester applies per-stream limits and writes chunks to storage; queriers answer LogQL queries. In monolithic mode one pod (-target=all) runs every part; in microservices mode each part is its own workload. Loki answers a refused push with 400 (invalid, not retried), 429 (rate limit, retried) or 401 (no tenant), and logs refused pushes as msg="write operation failed" details="<reason>", except 401s, which it does not log.

The commands use placeholders: my-namespace, my-loki (the Loki workload, its Service and its ConfigMap) and my-app-logger (a client). Replace them with the real names. Never read Secrets. Loki's config may hold storage keys: if it is in a Secret, do not read it; if it is in a ConfigMap, read only the parts you need and never repeat a key, password or token you see. Prefer the /config endpoint, which masks typed secret fields. Avoid kubectl describe pod on Loki: it prints literal environment values.

Never call /flush or /ingester/shutdown, not even with GET: Loki flushes all chunks or shuts the ingester down. Never POST to a ring page (forget= removes an instance). Use only the read endpoints listed here.

When to use

  • A log agent reports 4xx errors from Loki, or logs are missing in Grafana.
  • Loki pods crash, restart, or are not Ready.
  • Queries fail, time out, or return nothing for data that was sent.

Hand-offs, by skill name. When the evidence points elsewhere, continue with that skill; if it is not installed, keep going with the steps here and tell the user which skill would help:

  • The client cannot reach Loki at all (DNS, Service, NetworkPolicy): k8s-network-troubleshooting.
  • The log agent itself fails (Fluent Bit, the OpenTelemetry Collector): k8s-fluent-bit-troubleshooting, k8s-opentelemetry-collector-troubleshooting.
  • Grafana's Loki datasource fails while Loki answers: k8s-grafana-troubleshooting.
  • Loki pods are Pending or OOMKilled: k8s-workload-troubleshooting; a full volume: k8s-storage-troubleshooting.

Investigate

Work through the steps in order. Stop when you have the cause and its evidence.

1. See Loki's pods and the client's result. The HTTP status the client got points to the part that refused it.

bash
kubectl get pods -n my-namespace -o wide
kubectl logs -n my-namespace deployment/my-app-logger --tail=20

2. Read Loki's log: refused pushes, start-up errors, storage and ring errors.

bash
kubectl logs -n my-namespace deployment/my-loki --tail=200 | grep -E 'level=(error|warn)'
kubectl logs -n my-namespace deployment/my-loki --previous --tail=50
kubectl get events -n my-namespace --sort-by=.lastTimestamp

3. Check where the config lives and what it sets: auth_enabled, the limits and the schema. Check the kind of object first; a Secret is not read. Match only the keys you need, so storage credentials near them are not printed.

bash
kubectl get deployment my-loki -n my-namespace -o jsonpath='{.spec.template.spec.containers[0].args}{"\n"}{range .spec.template.spec.volumes[*]}{.name}{" "}{.configMap.name}{.secret.secretName}{"\n"}{end}'
kubectl get configmap my-loki -n my-namespace -o jsonpath='{.data.config\.yaml}' | grep -E 'auth_enabled|store:|schema:|period:|reject_old_samples|ingestion_rate|ingestion_burst|per_stream_rate|max_global_streams|max_line_size'

4. Ask Loki itself, through the API server's service proxy, if your credentials allow get on services/proxy (the built-in view role does not). With auth_enabled: true the query endpoints need a tenant header and answer no org id here; the status endpoints below do not.

bash
kubectl get --raw /api/v1/namespaces/my-namespace/services/my-loki:http-metrics/proxy/ready
kubectl get --raw /api/v1/namespaces/my-namespace/services/my-loki:http-metrics/proxy/services
kubectl get --raw "/api/v1/namespaces/my-namespace/services/my-loki:http-metrics/proxy/config?mode=diff"
kubectl get --raw /api/v1/namespaces/my-namespace/services/my-loki:http-metrics/proxy/metrics | grep -E 'loki_discarded_samples_total|status_code="(4|5)'

5. Open the matching reference and follow its steps:

What you seeReference
Pushes refused (400, 401, 429), write operation failed, tenants, limitsreferences/ingestion.md
Loki does not start, not Ready, ring and memberlist, storage, flushes, retention, queriesreferences/startup-storage-queries.md

Read the results

What the common findings mean (Loki 3.7):

  • Client 400 and msg="write operation failed" details="entry for stream '{app=\"my-app\", service_name=\"my-app\"}' has timestamp too old: 2020-09-13T12:26:40Z, oldest acceptable timestamp is: ...": the lines are older than reject_old_samples_max_age (7 days by default). Loki adds the service_name label itself. The client's clock or its timestamps are wrong, or it replays old logs.
  • Client 401 and nothing in Loki's log: auth_enabled: true (multi-tenant) and the client sends no X-Scope-OrgID header; Loki answers no org id. Every client and the Grafana datasource need the tenant ID.
  • Client 429 with Per stream rate limit exceeded or ingestion rate limit exceeded for user ...: a stream or the tenant sends more than per_stream_rate_limit (3MB/s) or ingestion_rate_mb (4MB/s) allow. Clients retry 429s, so logs arrive late or not at all.
  • Loki in CrashLoopBackOff with msg="validating config" err="CONFIG ERROR: invalid schema config: validating period_config: tsdb must always have periodic config for index set to 24h": the tsdb index needs period: 24h. Clients then get connection refused or no endpoints.
  • failed to flush chunks: ...: the ingester cannot write to object storage; the wrapped error names the bucket, credentials or network problem. Data stays in memory and the WAL until it can.
  • too many unhealthy instances in the ring or empty ring: ingesters are not ACTIVE or not found (memberlist cannot join, pods not Ready).

State the cause in one sentence, then the evidence you saw (the client's status, Loki's log line, the config field), then the proposed fix.

Proposed fix

Show each fix to the user before running it: what it changes and how to undo it. Loki's config, its limits and its storage are shared by every client and tenant: never change them yourself; hand them to the user as proposed fixes. A client's own config (its timestamps, its tenant header, its URL) belongs to that client's owners. Prefer fixing the source (the Helm values, the manifests in Git). Write each undo with the values you found.

Change Loki's config in its source and roll it out, for example index.period: 24h, or limits_config.reject_old_samples_max_age for a client that must replay older logs:

Proposed fix: review before running. The agent does not run this.

bash
kubectl apply -f my-loki-config.yaml
kubectl rollout restart deployment/my-loki -n my-namespace
# Undo: kubectl apply -f my-loki-config-before.yaml, then restart my-loki again

After a client's fix rolls out, restart the client to retry at once:

Ask first: the agent runs this only after the user approves it.

bash
kubectl rollout restart deployment/my-app-logger -n my-namespace
# Undo: none needed; the restart only recreates the pods with the same template

Sources

Checked against the Loki 3.7 documentation and source (v3.7.9):

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill K8s Loki Troubleshooting?

Verwenden Sie diesen Skill, wenn Grafana Loki unter Kubernetes Logs ablehnt, verwirft oder nicht abfragen kann: Clients erhalten 400, 401 oder 429 von /loki/api/v1/push, "write operation failed", "has timestamp too old", "entry too far behind", "Per stream rate limit exceeded", "ingestion rate limit exceeded", "maximum active stream limit exceeded", "no org id" (fehlender X-Scope-OrgID-Mandant), Loki stürzt beim Start mit "validating config" oder "invalid schema config" ab, "failed to flush chunks", Ring- oder Memberlist-Fehler ("empty ring", "too many unhealthy instances in the ring") oder...

Warum K8s Loki Troubleshooting in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. K8s Loki Troubleshooting besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich K8s Loki Troubleshooting in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-loki-troubleshooting ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können K8s Loki Troubleshooting nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit K8s Loki Troubleshooting verwenden?

So viele Sie möchten. In TypingMind können Sie K8s Loki Troubleshooting mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill K8s Loki Troubleshooting kostenlos?

Ja. Der Skill wird von k8s-servant auf GitHub unter der Lizenz Apache-2.0 veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇