k-logs

Tail k3s service logs by automating namespace and label lookups.

Updated Feb 9, 2025
One-click install
npx skills add https://github.com/carter2099/.dotfiles-homelab --skill k-logs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: k-logs
Source: https://github.com/carter2099/.dotfiles-homelab/tree/main/.claude/skills/k-logs
Command: npx skills add https://github.com/carter2099/.dotfiles-homelab --skill k-logs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tail logs from a k3s service across namespace and labels, reducing manual kubectl syntax on mobile.

Core Features & Use Cases

  • Tail logs with namespace and label lookups
  • Handles multiple pods by interleaved output (expected)
  • Clear guidance on when not to use for host-Docker apps

Quick Start

Tail logs for a specific k3s service by automatically locating the correct namespace and label and returning the last N lines.

Frequently Asked Questions about k-logs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I tail k3s service logs without specifying the namespace manually?

Tail k3s service logs by automating namespace and label lookups. The Skill runs kubectl get pods -A -l app=<service> to locate the pod, then executes kubectl logs -n <ns> -l <label>=<service> --tail=<lines> to fetch the output.

Can I retrieve k3s logs for services like traefik or grafana from a mobile device?

Yes, you can retrieve k3s logs on mobile. The Skill targets common k3s components such as traefik, grafana, prometheus, freshrss, uptime-kuma, and node-exporter, reducing manual kubectl syntax for mobile diagnostics.

What happens when tailing k3s logs matches multiple pods?

When tailing k3s logs matches multiple pods, the Skill gracefully handles the situation by providing interleaved output. This expected behavior allows you to view concurrent log streams from all matching pods in a single retrieval.

When should I not use kubectl logs to tail k3s application logs?

You should not use this approach to tail k3s logs for host-Docker applications. The Skill provides clear guidance that it is specifically designed for k3s-hosted services managed within Kubernetes, not standalone Docker containers.

Do I need to specify a tail length when fetching kubernetes logs?

You do not need to manually specify complex parameters to fetch kubernetes logs. The Skill enables one-shot log retrieval with a configurable tail length, automatically injecting the --tail=<lines> argument into the kubectl logs command.

What is the best way to automate kubectl log retrieval for k3s components?

The best way to automate kubectl log retrieval for k3s components is using a Skill that resolves namespaces and labels automatically. It performs the pod lookup and log extraction in one shot, preventing manual syntax errors.