AgentSkillsCN

k8s-logs

Kubernetes日志检索与分析

SKILL.md
--- frontmatter
name: k8s-logs
description: "Kubernetes log retrieval and analysis"
homepage: "https://docs.aof.sh/skills/k8s-logs"
metadata:
  emoji: "📋"
  version: "1.0.0"
  requires:
    bins: ["kubectl", "grep"]
    env: []
    config: ["~/.kube/config"]
  tags: ["kubernetes", "logging", "analysis"]

Kubernetes Logs Skill

Retrieve and analyze logs from Kubernetes pods to understand application behavior and troubleshoot issues.

When to Use This Skill

  • Need to view pod logs
  • Searching for specific error messages
  • Analyzing application behavior
  • Debugging intercontainer communication
  • Following log streams in real-time

Steps

  1. Get recent logskubectl logs {pod-name} --tail=50
  2. Get all logskubectl logs {pod-name} --all-containers=true
  3. Search logskubectl logs {pod-name} | grep ERROR
  4. Follow logskubectl logs {pod-name} -f
  5. Get previous logskubectl logs {pod-name} --previous