k8s-tools

module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: Apache-2.0

README

k8s-tools

A toolset for inspecting Kubernetes clusters.

Provides SQL interface for querying information about K8s:

  • Containers
  • DaemonSets
  • Deployments
  • HorizontalPodAutoscalers
  • Nodes
  • Pods
  • Services
  • StatefulSets

Getting Started

Installation

[!IMPORTANT] CGO_ENABLED=1 is required for DuckDB.

CGO_ENABLED=1 go install github.com/Hexta/k8s-tools/cmd/k8s-tools@latest

Usage

CLI Documentation

Examples
Ad-hoc tools
  • Print nodes utilisation in zone eu-central-1a
    k8s-tools node utilisation -l topology.kubernetes.io/zone=eu-central-1a
    
Internal DB

k8s-tools can save K8s cluster state in internal DB to ease analyzing. DB Documentation

  1. Init DB.
    k8s-tools db init
    
  2. Query data.
    • Top10 CPU underutilized nodes
      k8s-tools db query "select name, cpu_utilisation, labels['karpenter.sh/nodepool'] from k8s.nodes order by cpu_utilisation asc limit 10"
      
  3. Run SQL TUI.
    k8s-tools db tui
    
    DB TUI
Useful queries
  1. List tables
    k8s-tools db query "select table_name from information_schema.tables where table_schema='k8s' order by table_name"
    

Contributing

Please see our contributing guidelines.

Directories

Path Synopsis
cmd
internal
db
k8s
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL