Communitygithub.com

K9s スキル

Kubernetes クラスターの高速な端末ベース管理とトラブルシューティングのためのエキスパート K9s CLI アシスタンス。

K9s スキル とは?

このスキルは、Kubernetes クラスターを管理・トラブルシューティングするための強力なターミナル UI(TUI)ツールである K9s の専門的な支援を提供します。主な機能には、ポッド、サービス、デプロイメントの対話的なナビゲーション、リアルタイムのログストリーミング、ポートフォワーディング、カスタムプラグインによる迅速なデバッグが含まれます。このスキルは、K9s の主要なキーボードショートカット、プラグイン設定、読み取り専用モードでの安全な運用、大規模クラスター向けのベストプラクティスをカバーしています。K9s は Web ダッシュボードよりも高速で、`kubectl` よりも発見性が高く、開発者やプラットフォームエンジニアに最適です。このスキルは、`kubectl` コマンドを自動化するための `~/.config/k9s/plugins.yaml` の設定方法や、`k9s --readonly` のような安全な起動オプションについても説明しています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/G1Joshi/Agent-Skills/tree/HEAD/skills/tools/k9s

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

K9s

K9s は、Kubernetes のためのターミナル UI(TUI)です。Web ダッシュボードをクリックするよりも高速で、生の kubectl よりも発見性に優れています。

使用するタイミング

  • 端末ベースの Kubernetes クラスター管理: ポッド、サービス、デプロイメントをナビゲートするための高速でインタラクティブな curses UI。
  • リアルタイムログストリーミングとリソース監視: マルチポッドログのテーリング、CPU/メモリによるソート、ポートフォワーディング。
  • カスタム K9s プラグインとエイリアス: カスタムシェルコマンド(例:stern、cert-manager status の実行)で CLI を拡張。
  • 読み取り専用の検査とトラブルシューティング: 読み取り専用モードで本番クラスターを安全にデバッグ。

クイックスタート

# アクティブな kubeconfig で k9s を起動
k9s

# k9s でのナビゲーションショートカット:
# :pods      - 全ネームスペースのポッドを表示
# :deploy    - デプロイメントを表示
# :svc       - サービスを表示
# /<term>    - アクティブビューのアイテムをフィルタリング
# l          - 選択したポッドのログをストリーム
# s          - 選択したコンテナ内でシェル(exec)を開く

コアコンセプト

#カスタムプラグイン設定(plugins.yaml)

迅速なデバッグのためのカスタムキーボードコマンドを追加:

# ~/.config/k9s/plugins.yaml
plugin:
  # デプロイメントで 'Shift-D' を押して詳細なロールアウト履歴を表示
  rollout-history:
    shortCut: Shift-D
    confirm: false
    description: "ロールアウト履歴"
    scopes:
      - deployments
    command: kubectl
    background: false
    args:
      - rollout
      - history
      - deployment/$NAME
      - -n
      - $NAMESPACE

  # ポッドで 'Shift-F' を押してインタラクティブデバッグコンテナを起動
  debug-pod:
    shortCut: Shift-F
    confirm: true
    description: "ポッドをデバッグ"
    scopes:
      - pods
    command: kubectl
    background: false
    args:
      - debug
      - -it
      - $NAME
      - --image=nicolaka/netshoot
      - -n
      - $NAMESPACE

#必須ナビゲーションとキーボードショートカット

クラスター管理の高速化:

  • :pod: ネームスペースをまたいでポッドビューにジャンプ。
  • :svc、:deploy、:ing: サービス、デプロイメント、イングレスにジャンプ。
  • /: リソースを名前またはステータスで検索・フィルタリング。
  • l: 選択したポッドまたはコンテナのログをテーリング。
  • s: 選択したコンテナ内でインタラクティブシェル(sh / bash)を開く。
  • Shift-F: ローカルポートを選択したポッドのサービスポートにポートフォワード。
  • y: 選択したリソースの完全な YAML マニフェストを表示。

#カスタムオプションで K9s を起動

安全なモードで K9s を起動:

# 本番環境での誤ったポッド削除を防ぐために読み取り専用モードで起動
k9s --readonly --namespace production

# カスタムコンテキストとリフレッシュレートを指定
k9s --context prod-eks-cluster --refresh 2

共通パターン

#カスタム K9s ショートカットとプラグイン 問題: 異なるネームスペース間でカスタム kubectl コマンドを頻繁に実行する。
解決策: ~/.config/k9s/plugin.yaml でカスタムプラグインを定義する。

# ~/.config/k9s/plugin.yaml
plugin:
  raw-logs:
    shortCut: Shift-L
    description: "切り詰めずにログをテーリング"
    scopes:
      - pods
    command: kubectl
    background: false
    args:
      - logs
      - -f
      - $NAME
      - -n
      - $NAMESPACE
      - --context
      - $CONTEXT

ベストプラクティス(2026)

  • 推奨: 本番環境に接続する際は k9s --readonly を使用して誤った削除を防ぐ。
  • 推奨: 繰り返し使用する kubectl コマンドのために ~/.config/k9s/plugins.yaml でカスタムプラグインを設定する。
  • 推奨: 長い kubectl port-forward コマンドを入力する代わりに、ポートフォワードショートカット(Shift-F)を使用する。
  • 推奨: :<all> ネームスペースまたは特定のネームスペースを使用してビューをフィルタリングし、API サーバーのクエリ負荷を軽減する。
  • 非推奨: 多数のアクティブなポートフォワードを開いたままにしない。:portforwards ビューで管理・終了する。
  • 非推奨: 適切な --refresh 間隔を設定せずに大規模なエンタープライズクラスターに対して K9s を実行しない。
  • 非推奨: バックアップを確認せずに K9s 経由で永続ボリューム要求(PVC)を削除しない。

トラブルシューティング

エラー原因解決策
Boom!! K9s cannot connect to clusterアクティブな kubeconfig コンテキストが無効、またはクラスターエンドポイントに到達不可。kubectl cluster-info で接続を確認し、kubectl config use-context でコンテキストを切り替える。
Pod logs failing to stream in k9sポッドコンテナがクラッシュしたか、ユーザーに RBAC pods/log 権限がない。コンテナのステータスを確認し、クラスターロールの権限を検証する。
Terminal display corrupted / artifacts互換性のないターミナル terminfo または小さなターミナルウィンドウ。export TERM=xterm-256color を実行し、ターミナルウィンドウを最大化する。

参考

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

G1Joshi/Agent-Skills

Expert Dask distributed computing assistance covering Dask DataFrames, Arrays, Futures, and cluster scaling. Use when analyzing datasets too large for pandas on a single machine or multi-node cluster.

G1Joshi/Agent-Skills

Expert dbt (data build tool) assistance covering SQL modeling, Jinja macros, tests, documentation, and semantic layer. Use when building analytics engineering pipelines on BigQuery, Snowflake, or PostgreSQL.

G1Joshi/Agent-Skills

Expert JAX assistance covering Autograd, XLA compilation (`jit`), vectorization (`vmap`), and parallelization (`pmap`). Use when building high-performance numerical computing and cutting-edge deep learning research.

G1Joshi/Agent-Skills

Expert Ray distributed computing assistance covering Ray Core (actors, tasks), Ray Train, Ray Tune, and Ray Serve. Use when scaling Python compute and ML training across multi-node clusters.

G1Joshi/Agent-Skills

Expert Git version control assistance covering branching, interactive rebase, cherry-pick, submodules, worktrees, and conflict resolution. Use when managing source code history and collaboration workflows.

G1Joshi/Agent-Skills

Expert SWC assistance covering high-performance Rust-based JavaScript/TypeScript compilation, .swcrc configuration, Jest testing via @swc/jest, and minification. Use when replacing Babel with SWC for faster builds, accelerating test execution, or compiling modern ECMAScript features.

G1Joshi/Agent-Skills

Expert Tig assistance covering text-mode interface for Git, interactive staging, commit graph visualization, diff exploration, and blame navigation. Use when navigating Git commit history in the terminal, staging hunks interactively, browsing file changes, or reviewing revisions.

G1Joshi/Agent-Skills

Expert Vim assistance covering modal editing, .vimrc configuration, registers, macros, search/replace, and plugin management via vim-plug. Use when editing text efficiently in terminal environments, writing Vimscript, recording macros, or configuring core Vim settings.

G1Joshi/Agent-Skills

Expert Zed editor assistance covering high-performance Rust-based text editing, multi-buffer editing, language server protocols (LSP), and AI assistant integrations. Use when configuring Zed settings.json, setting up language extensions, collaborating in real-time channels, or optimizing editor startup speed.

G1Joshi/Agent-Skills

Expert Zsh assistance covering shell customization, Oh My Zsh plugins, Zinit plugin manager, prompt engineering (Starship/Powerlevel10k), and shell scripting. Use when configuring .zshrc, writing Zsh automation scripts, optimizing shell startup time, or configuring tab-completion.

G1Joshi/Agent-Skills

Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].

関連スキル